I edited my code so that it looks like this:
def save_rates(exch):
    store = open("exch.txt","w")
    for exch, rate in rates.items():
        store.write(exch + '\n')
        store.write(`rate` + '\n')
    store.close()
 
def load_rates(exch):
    import os
    filename = 'exch.txt'
    if os.path.exists(filename):
       store = open(filename,'r')
       for line in store:
          conv = line.strip()
          rate = float(store.next().strip())
          exch[conv] = rate
    else:
        store = open(filename,'w') # create new empty file
    store.close()
 
When I ran the program, I got this:
The Currency Exchange Program
By Nathan Pinno
 
Traceback (most recent call last):
  File "D:\Python24\exchange.py", line 45, in -toplevel-
    load_rates(rates)
  File "D:\Python24\exchange.py", line 19, in load_rates
    rate = float(store.next().strip())
StopIteration
 
How do I fix this?
 
Thanks for the help so far,
Nathan Pinno,
MSN Messenger: [EMAIL PROTECTED]
Yahoo! Messenger: spam_swatter31
AIM: f3mighty
ICQ: 199020705  
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to