For example, I'm having this: a = [['1'], ['2'], ['3']]
How can I change it into: a = ['1', '2', '3']
Thanks!
For example, I'm having this: a = [['1'], ['2'], ['3']]
How can I change it into: a = ['1', '2', '3']
Thanks!
ooh, i'll play.
a = [i[0] for i in a]
(assuming you only have one item in each sublist)
Like so:
a = [['1'], ['2'], ['3']]
lst = []
for subLst in a:
lst.extend(subLst)
print(lst)
But in most cases this means that the generation of the list a
get improved ...