python3 pelatologio.py gives  me error in this line:

Traceback (most recent call last):
  File "pelatologio.py", line 283, in <module>
    ''' % (months[key], key) )
KeyError: 1

The code is:

#populating months into a dropdown menu
years = ( 2010, 2011, 2012, 2013 )
months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 
'Μάϊος':5, 'Ιούνιος':6, \
           'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 
'Νοέμβριος':11, 'Δεκέμβριος':12 }

print('''
<form method="post" action="">
        <select name="month">
''')
        
for key in sorted( months.values() ):
        print('''
                <option value="%s"> %s </option>
        ''' % (months[key], key) )
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to