Hi all,

Can someone please explain to me why I can't do something like this:

a = 1

for value in a:
    print str(value)

If I run this I get the error:

'int' object is not iterable

Obivously this is an absurd example that I would never do, but in my 
application the length of 'a' can be anything greater than 0, and I want to 
be able to handle cases when 'a' has only one element without coding a 
special case just in the event that len(a) = 1.

any suggestions are appreciated,
trevis 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to