here’s the message :
Traceback (most recent call last):
File “C:\Users\Giroux\Desktop\Coding\Python\Py4e\03 - 01 EX - Python for Everybody Course\EX7-1\eexc-chap9.py”, line 25, in
emails[email] = emails.get(email,0) + 1
TypeError: descriptor ‘get’ for ‘dict’ objects doesn’t apply to a ‘str’ object
here’s my code:
fname = input("enter file: ")
try:
hand = open(fname)
except:
print(“file cannot be read”,fname)
exit()
emails = dict
for li in hand:
if li.startswith("From "):
li = li.split()
email = li[1]
emails[email] = emails.get(email,0) + 1
print(emails)
so whats going on ?
im still new by the way