'How to split string that is a part of a tuple list in python
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
Solution 1:[1]
There probably is a more pythonic way of doing this, but the following works:
for pair in my_list:
print(pair[0])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | gchapuis |
