from faker import Faker # 引入库 faker = Faker(locale='zh_CN') # 添加 for _ in range(10): print(faker.ssn()) print(faker.name()) print(faker.date_time()) # from faker import Faker # 引入库 # # f = Faker(locale='zh_cn') # 添加 # # fileName = 'writePeopleData.txt' # 准备写入的文件 # n = 0 # while n <= 100: # 执行100次 # n += 1 # 每执行1次之后加1 # womanName = f.name_male() # 生成女性名 # idCard = f.ssn() # 身份证号 # phone = f.phone_number() # 手机号 # fileContent = "女生姓名:%s" % womanName, '身份证号:%s' % idCard, "手机号:%s" % phone + " " # # with open(fileName, 'a', encoding='utf-8') as file: # 追加模式 # file.writelines(fileContent) # # print(fileContent)