Line indexing in Python

seafoid fitzpadj at tcd.ie
Fri Dec 18 16:24:54 EST 2009


Hey folks,

Is it possible to assign a list within a nested list to a variable?

Example:

l = [['1', '2', '3'], ['4', '5', '6']]

for i in l:
    if i[0][1] == '1':
        m = i

Indeed, I generally do not understand how to assign variables within a loop!

Is there an easy way to 'flatten' a nested list and assign the lists to
variables?

Thanks,
Seafoid.
-- 
View this message in context: http://old.nabble.com/Line-indexing-in-Python-tp26845253p26849921.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list