1 from faker import Faker 2 3 # fake = Faker() 4 5 #本地化处理 6 fake = Faker('zh_CN') 7 # print(fake.name()) 8 # print(fake.address()) 9 10 #保存在文件 11 with open('./data1.txt','w',encoding='utf-8') as f: 12 for _ in range(200): 13 name = fake.name() 14 address = fake.address() 15 num = fake.phone_number() 16 # print(name+','+address) 17 data = name+','+num+','+address+' ' 18 f.write(data) 19 print('完成!')