add comments
This commit is contained in:
@@ -7,8 +7,9 @@ import xlsxwriter
|
|||||||
|
|
||||||
from definitions import CONTACT_LIST_FILE
|
from definitions import CONTACT_LIST_FILE
|
||||||
from pojo.contact_pojo import ContactPojo
|
from pojo.contact_pojo import ContactPojo
|
||||||
|
from utils.generate_random_passport_id import get_random_passport_id_number
|
||||||
|
|
||||||
phone_number_prefix = ['6', '7']
|
phone_number_prefix = ['6']
|
||||||
|
|
||||||
|
|
||||||
class ExcelHelper:
|
class ExcelHelper:
|
||||||
@@ -116,7 +117,7 @@ def write_new_contacts_to_excel(valid_contacts: list):
|
|||||||
row = row + 1
|
row = row + 1
|
||||||
for info in valid_contacts:
|
for info in valid_contacts:
|
||||||
info.phone = get_random_phone_numbers()
|
info.phone = get_random_phone_numbers()
|
||||||
info.passport = get_random_id_number()
|
info.passport = get_random_passport_id_number()
|
||||||
info.mail = generate_email_from_name(info.first_name, info.last_name)
|
info.mail = generate_email_from_name(info.first_name, info.last_name)
|
||||||
# Iterate over the data and write it out row by row.
|
# Iterate over the data and write it out row by row.
|
||||||
worksheet.write(row, col, "{} {}".format(info.last_name, info.first_name))
|
worksheet.write(row, col, "{} {}".format(info.last_name, info.first_name))
|
||||||
@@ -129,6 +130,6 @@ def write_new_contacts_to_excel(valid_contacts: list):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
excel_reader = ExcelHelper()
|
excel_reader = ExcelHelper()
|
||||||
contacts = excel_reader.read_names("C:/Users/landd/Desktop/1000.xlsx")
|
contacts = excel_reader.read_names("C:/Users/landd/Desktop/rdv/08-06/500_08_06.xlsx")
|
||||||
print(contacts)
|
print(contacts)
|
||||||
write_new_contacts_to_excel(valid_contacts=contacts)
|
write_new_contacts_to_excel(valid_contacts=contacts)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ def get_random_id_number() -> str:
|
|||||||
id_number = str(ran)
|
id_number = str(ran)
|
||||||
return id_number
|
return id_number
|
||||||
|
|
||||||
|
# 产生中国护照号
|
||||||
def get_random_passport_id_number() -> str:
|
def get_random_passport_id_number() -> str:
|
||||||
S = 7 # number of characters in the string.
|
S = 7 # number of characters in the string.
|
||||||
ran = ''.join(random.choices(string.digits, k=S))
|
ran = ''.join(random.choices(string.digits, k=S))
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user