from faker import Faker
fake_ = Faker(locale='zh_CN')
with open('file.csv', "a", encoding="utf-8") as f:
for i in range(100,8000):
f.write(f"{i},{fake_.name()},{fake_.province()},{fake_.ssn()}\n")
import csv
Lists = []
with open("file.csv", "rt",encoding="utf-8") as csvfile:
reader = csv.reader(csvfile)
for row in reader: # 迭代讀取所有行資料
Lists.append(row)
print(row) # row 為列表型別: ['value1', 'value2', ...]
print(Lists)