I have a simple list as below:
lst = ['11 12221/n']
I want to split the first item in a list, as shown below:
['11', '12221']
It seems relatively simple to me, but I can't get it to work. My first approach was to do:
lst[0].split()
but when I print the list, there are no changes. So I tried:
newLst=[]
for x in lst:
newList.append(x.split())
But from this I get
[['11', '12221\n']]
I think that I should fundamentally understand the misunderstanding of the list, can someone explain why my code did not work and how it should be done?
thank
source
share