Split a string only by first space in python
Just pass the count as second parameter to str.split
function.
>>> s = "238 NEO Sports"
>>> s.split(" ", 1)
['238', 'NEO Sports']
RTFM: str.split(sep=None, maxsplit=-1)
>>> "238 NEO Sports".split(None, 1)
['238', 'NEO Sports']
Use string.split()
string = "238 NEO Sports"
print string.split(' ', 1)
Output:
['238', 'NEO Sports']