S
Santanu Chatterjee
Hello everybody,
I am very new to Python. So pardon me if this question is
too dumb.
Suppose I have the following list:
myList = [('a','hello), ('b','bye')]
How do I get only the first element of each tuple in the
above list to be printed without using:
for i in range(len(myList)):
print myList[0]
or:
for i in myList:
print i[0]
I tried:
print myList[:][0]
but it seems to have an altogether different meaning.
Regards,
Santanu
I am very new to Python. So pardon me if this question is
too dumb.
Suppose I have the following list:
myList = [('a','hello), ('b','bye')]
How do I get only the first element of each tuple in the
above list to be printed without using:
for i in range(len(myList)):
print myList[0]
or:
for i in myList:
print i[0]
I tried:
print myList[:][0]
but it seems to have an altogether different meaning.
Regards,
Santanu