python split string by space or tab only code example
Example 1: split string by spaces python
"many fancy word \nhello \thi".split()
['many', 'fancy', 'word', 'hello', 'hi']
Example 2: python split space or tab
>>> teststr = "a v w ef sdv \n wef"
>>> print teststr
a v w ef sdv
wef
>>> teststr.split()
['a', 'v', 'w', 'ef', 'sdv', 'wef']
>>> teststr.split(" ")
['a', '', '', 'v', 'w', '', '', 'ef', 'sdv', '', '', '\n', '', '', 'wef']