initial creation

This commit is contained in:
2025-05-20 11:57:43 -04:00
commit c98b612926
8447 changed files with 1862526 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env python
import csv
field_names = ['term', 'firstname', 'lastname', 'birthplace', 'state', 'party'] # <1>
with open('../DATA/presidents.csv') as presidents_in:
rdr = csv.DictReader(presidents_in, fieldnames=field_names) # <2>
for row in rdr: # <3>
print('{:25s} {:12s} {}'.format(row['firstname'], row['lastname'], row['party'])) # <4>
# string .format can use keywords from an unpacked dict as well:
# print('{firstname:25s} {lastname:12s} {party}'.format(**row))