Sunday, 11 August 2013

access elements within list of list in python

access elements within list of list in python

I made a list of list. I want to access each element within the list as
well as each of its character.
I/P: a1=[1,2,3,('a','b'),'c']
o/p: b=[1,2,3,'a','b','c']
I tried in this way, but it shows error
for i in a1:
for j in i:
print j
Will any mentor show me how to access/traverse each element of the list
within list
Thank You,

No comments:

Post a Comment