# L-37 MCS 275 Wed 14 Apr 2010 : tempdbtuples.py # Given data stored as dictionaries in a file "temperatures.txt", # this script shows the data as tuples as they would be used for # insertion in a MySQL table. file = open('temperatures.txt','r') key = 0 while True: L = file.readline() if L == '': break d = eval(L) tp = (key,d['place'],d['date'],d['time'],d['temp']) print tp key = key + 1 file.close()