Python: Parsing

From OnnoWiki
Revision as of 10:57, 30 November 2015 by Onnowpurbo (talk | contribs) (New page: "hello world sample text".split() will split on any whitespace. If you only want to split on spaces "hello world sample text".split(" ") regex version would be something like this ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


"hello world sample text".split()

will split on any whitespace. If you only want to split on spaces

"hello world sample text".split(" ")

regex version would be something like this

re.split(" +", "hello world sample text")

which works if you have multiple spaces between the words