Biggles
20-07-2006 21:20:42
hey, i'm getting a really strange error with python, using 2.4.
it's easily reproduced if you type the following into the interpreter:
For some reason i get a TypeError: unsubscriptable object error on the print j when I do this, and I just don't get why! Anyone else ever run into this before?
ps Sorry, I know this isn't really a general python forum, but I thought it'd be out of place in the 'Back to Basics' as it's not really C++ and I don't really frequent any propper python forums (if anyone can suggest one that's active and likely to be able to answer these sorts of questions, that'd be awesome as well)
it's easily reproduced if you type the following into the interpreter:
j=[5,6]
for k in range(2):
for i in range(2):
print j[i]
For some reason i get a TypeError: unsubscriptable object error on the print j when I do this, and I just don't get why! Anyone else ever run into this before?
ps Sorry, I know this isn't really a general python forum, but I thought it'd be out of place in the 'Back to Basics' as it's not really C++ and I don't really frequent any propper python forums (if anyone can suggest one that's active and likely to be able to answer these sorts of questions, that'd be awesome as well)