Skip to content

Commit 4257e2f

Browse files
author
saschwafel
committed
String formatting fixed NoneType issues
1 parent 34e31c5 commit 4257e2f

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

Students/SSchwafel/Project/InformedVoter.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,13 @@ def find_legislators():
6666

6767
def print_legislators():
6868

69-
#FIX THE FORMATTING BELOW!!!
70-
#Also, be sure to add .encode('utf-8')
71-
7269
for i in legislators['results']:
73-
#Troubleshooting output
74-
#print i['first_name'] + i['last_name']
7570

7671
if i['chamber'] == 'house' and i['gender'] == 'M':
77-
print i['first_name'] + i['last_name']
78-
# print 'Congressman ' + i['first_name'] + ' ' + i['last_name'] + ' - ' + i['party']+ '\n' + 'Phone: ' + i['phone'] + '\n' + 'Website: ' + i['website'] + '\n'
79-
#if i['chamber'] == 'house' and i['gender'] == 'F':
80-
# print 'Congresswoman ' + i['first_name'] + ' ' + i['last_name'] + ' - ' + i['party']+ '\n' + 'Phone: ' + i['phone'] + '\n' + 'Website: ' + i['website'] + '\n'
81-
#elif i['chamber'] == 'senate':
82-
# print 'Senator ' + i['first_name'] + ' ' + i ['last_name'] + ' - ' + i['party']+ '\n' + 'Phone: ' + i['phone'] + '\n' + 'Website: ' + i['website'] + '\n'
72+
print 'Congressman {} {} - {} \nPhone: {}\nWebsite: {}\n'.format(i['first_name'],i['last_name'],i['party'],i['phone'],i['website'] )
73+
if i['chamber'] == 'house' and i['gender'] == 'F':
74+
print 'Congresswoman {} {} - {} \nPhone: {}\nWebsite: {}\n'.format(i['first_name'],i['last_name'],i['party'],i['phone'],i['website'] )
75+
elif i['chamber'] == 'senate':
76+
print 'Senator {} {} - {} \nPhone: {}\nWebsite: {}\n'.format(i['first_name'],i['last_name'],i['party'],i['phone'],i['website'] )
8377

8478
print_legislators()

0 commit comments

Comments
 (0)