need to remove duplicated emails

This commit is contained in:
2022-03-23 19:11:07 +01:00
parent 8432e33392
commit 2506165900
5 changed files with 22 additions and 32 deletions
+10 -7
View File
@@ -6,15 +6,15 @@ import xlsxwriter
import params
from pojo.ReserveResultPojo import ReserveResultPojo
from pojo.contact_pojo import ContactPojo
from utils.excel_reader import ExcelHelper
def get_random_id_number ()-> str:
def get_random_id_number() -> str:
# write_the_valid_profiles_to_excel()
S = 8 # number of characters in the string.
# call random.choices() string module to find the string in Uppercase + numeric data.
ran = ''.join(random.choices(string.digits, k = S))
id_number = "57"+str(ran)
print("The randomly generated string is : 94" + str(ran)) # print the random data
ran = ''.join(random.choices(string.digits, k=S))
id_number = "57" + str(ran)
print("The randomly generated string is : 94" + str(ran)) # print the random data
return id_number
@@ -36,6 +36,10 @@ def write_the_valid_profiles_to_excel():
contact = ContactPojo(reserve_pojo.phone, passport_number=get_random_id_number(),
last_name=reserve_pojo.lastName, first_name=reserve_pojo.firstName, ccid="",
mail=reserve_pojo.email, position=0)
seed = 8 # number of characters in the string.
# call random.choices() string module to find the string in Uppercase + numeric data.
ran = ''.join(random.choices(string.digits, k=seed))
contact.mail = "{}_{}{}@163.com".format(contact.first_name, contact.last_name, ran)
# contact.passport = get_random_id_number()
# if contact.passport == None or len(contact.passport) == 0:
# old_contact = [item for item in exist_contacts if item.mail == contact.mail]
@@ -67,7 +71,6 @@ def write_the_valid_profiles_to_excel():
workbook.close()
if __name__ == '__main__':
# get_random_id_number()
write_the_valid_profiles_to_excel()
write_the_valid_profiles_to_excel()