>>> ",".join("get all the words as a list then make them a csv".split())
'get,all,the,words,as,a,list,then,make,them,a,csv'
Last active
August 31, 2019 14:54
-
-
Save tsal/2a683999492784f0e86998858cb656cf to your computer and use it in GitHub Desktop.
strings are first class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"inline string separated by spaces".split() | |
",".join("get all the words as a list then make them a csv".split()) |
>>> long = "this is a longsep string with sep as a separator"
>>> short = "strings,are,first,class,in,python"
>>>
>>> print(long.split("sep"))
['this is a long', ' string with ', ' as a ', 'arator']
>>>
>>> print(short.split(","))
['strings', 'are', 'first', 'class', 'in', 'python']
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long = "this is a longsep string with sep as a separator" | |
short = "strings,are,first,class,in,python" | |
print(long.split("sep")) | |
print(short.split(",")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment