I\'m new to Python and can\'t find a way to insert a string into a list without it getting split into individual characters:
>>> list=[\'hello\',\'w
Another option is using the overloaded + operator
:
>>> l = ['hello','world']
>>> l = ['foo'] + l
>>> l
['foo', 'hello', 'world']
I suggest to add the '+' operator as follows:
list = list + ['foo']
Hope it helps!
Don't use list as a variable name. It's a built in that you are masking.
To insert, use the insert function of lists.
l = ['hello','world']
l.insert(0, 'foo')
print l
['foo', 'hello', 'world']