I have a 2 elements list which I want to extend with the elements of another one. playing around in Jupyter I found this strange behaviour that I can not understand.
# this is my first list
columnslist=['app','SUM']
['app','SUM']
# it is going to be extended with the values A and B
columnslist.extend(['A','B'])
['app','SUM','A','B']
# It is possible to make a list out of a string in this way
print(list('AB'))
['A','B']
# I realise that list('AB')= ['A','B']
This works:
columnslist.extend(list('AB'))
# but the following does not work:
mytext='this is a text to be split'
columnslist.extend(mytext.split())
why is that so? thanks