-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_entries_csv.py
executable file
·93 lines (78 loc) · 2.04 KB
/
create_entries_csv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python3
import argparse
import csv
import datetime
import random
FMT = '%Y-%m-%d %H:%M:%S'
NAMES = [
"Edith Ferguson",
"Kylie Filer",
"Kenneth Omeara",
"Naomi Bell",
"Josef Hare",
"Eva Bermudes",
"Sandra Holmes",
"Helen Piper",
"Frances Kridler",
"Jared Baum",
"Kevin Brewer",
"Sarah Trotter",
"Ernest Martinez",
"Betty Matthews",
"Nicolas Rios",
"Jennifer Blenman",
"Ethel Gilbert",
"Dennis Vercher",
"Mary Haro",
"Martha Gonzalez",
"Sandra Lee",
"Marla Diaz",
"Louise Johnson",
"Stephanie Ross",
"Chad White",
"Stephanie Caldwell",
"Pamela Carr",
"Beatriz Ruzich",
"Adolfo Clarke",
"Shirley Arndt",
"Betty Bueche",
"Lawrence March",
"Emma Mccarthy",
"Evelyn Kirk",
"Marilyn Thompson",
"Albert Mayes",
"James Murphy",
"Melvin Riley",
"Yvonne Velazquez",
"Dorothy Hairston",
"Cecile Kaan",
"Garrett Wright",
"Florentina Torres",
"Deborah Rhodes",
"Donald Cade",
"Bethany Dominguez",
"Timothy Harting",
"Jane Jenkins",
"Richard Geesey",
"Robert Sommer",
]
def main():
parser = argparse.ArgumentParser()
parser.add_argument("filename", help="give a name for the file to create")
parser.add_argument("rows", help="the number of rows to create", type=int)
args = parser.parse_args()
generate(args.filename, args.rows)
def generate(name, row_count=10):
count = 0
print("Creating file: {} with {} rows.".format(name, row_count))
with open(name, 'w', newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',', quotechar='|',
quoting=csv.QUOTE_MINIMAL)
while count < row_count:
spamwriter.writerow([NAMES[random.randint(0, 19)],
random.uniform(1, 100000),
datetime.datetime.utcnow().strftime(FMT)])
count += 1
print("Done generating file")
if __name__ == '__main__':
main()