How to split string that is a part of a tuple list in python

Question:

I have a list of string tuples (list[tuple[str, str]]) like this [('JimKing', 'TheKing'), ('GadgetKing', 'EnergyKing'), ('ThingKing', 'Energyking')] and I would like to split and print the first string in the tuples eg list[0] = 'JimKing'
Thanks in advance

Asked By: James Norman

||

Answers:

There probably is a more pythonic way of doing this but the following works:

for pair in my_list:
   print(pair[0])
Answered By: gchapuis
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.