def find_details(id2find):
surfers_f = open("surfing_data.csv")
for eash_line in surfers_f:
s = {}
(s["id"], s["country"], s["average"], s["board"], s["age"]) = eash_line.split(";")
if id2find == int(s["id"]):
surfers_f.close()
return(s)
return({})
lookup_id = int(input("Enter the id of the surfer: "))
surfer = find_details(lookup_id)
if surfer:
print("ID: " + surfer["id"])
print("Name: " + surfer["name"])
print("Country: " + surfer["Average"])
print("Board type: " + surfer["board"])
print("Age: " + surfer["age"])
The database file can be found at http://www.headfirstlabs.com/books/hfprog/
In the above program I'M getting two errors, one on line 7 and another on line 17. I can't figure out what's going on. It says to many values to unpack. Thanks for any and all help.
One more thing, what is a .csv file