NoneType object not iterable

tom at finland.com tom at finland.com
Fri Jul 13 19:44:13 CEST 2007


Hi!
My code is

 > db = {}
 >
> def display():
>     keyList = db.keys()
>     sortedList = keyList.sort()
>     for name in sortedList:
>         line = 'Name: %s, Number: %s' % (name, db[name])
>         print line.replace('\r', '')

And it gives following error:

>     for name in sortedList:
> TypeError: 'NoneType' object is not iterable

How can sortedList variable turn into NoneType? I just don't get it...



More information about the Python-list mailing list