Skip to content

Instantly share code, notes, and snippets.

@werterzz
Created February 13, 2022 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save werterzz/c5b78b48ed243240d287c4b6c35161a1 to your computer and use it in GitHub Desktop.
Save werterzz/c5b78b48ed243240d287c4b6c35161a1 to your computer and use it in GitHub Desktop.
import sys
import csv
from faker import Faker
fake = Faker()
number_of_records = int(sys.argv[1])
with open('random-person.csv', mode='w') as file:
file_writer = csv.writer(file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
file_writer.writerow(['first_name', 'last_name', 'age'])
for _ in range(number_of_records):
file_writer.writerow([fake.first_name(), fake.last_name(), fake.numerify("@#")])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment