My line:
"This is a string"
I want to turn it into a list:
["This", "is", "a", "string"]
I use the split(" ") method, but it adds spaces as list items. Please, help,
split(" ")
Regards
>>> v="This is a string" >>> v.split() ['This', 'is', 'a', 'string']
just use split() .
split()
It will not add spaces as elements if you just use .split() instead of .split(' ')
.split()
.split(' ')
>>> "This is a string".split() ['This', 'is', 'a', 'string']
As the docs say, don't pass an argument.
Source: https://habr.com/ru/post/1395555/More articles:XML :: LibXML remove header when writing to xml - xmlIgnore return values โโof function Ada - adaJavascript merging an array if there is a duplicate value - javascriptWhy can't I create a new hash from the selected keys in ruby? - ruby โโ| fooobar.comCreating Impulse Using JavaScriptNode (Web Audio API) - javascriptMake WPF control over a web browser - c #Java shift operator - javaProblem returning Dataset via WCF service - returnHow to save and reload image using ALAsset? - iosComparison formula in free nhibernate - mappingAll Articles