My string is:
"This is a string"
I want to turn it into a list:
["This", "is", "a", "string"]
I use the split(" ")
method, but it adds whitespaces as list elements. Please help,
Best Regards
>>> v="This is a string"
>>> v.split()
['This', 'is', 'a', 'string']
just use split()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With