Using ( , ) , you capture a group, if you just delete them, you will not have this problem.
>>> str1 = "abcd" >>> re.split(" +", str1) ['a', 'b', 'c', 'd']
However, there is no need for a regular expression, str.split without specifying the specified delimiter will split this into a space for you. That would be the best way in this case.
>>> str1.split() ['a', 'b', 'c', 'd']
If you really need a regular expression, you can use it ( '\s' represents spaces and it is clearer):
>>> re.split("\s+", str1) ['a', 'b', 'c', 'd']
or you can find all characters without spaces
>>> re.findall(r'\S+',str1) ['a', 'b', 'c', 'd']
jamylak Jun 11 2018-12-12T00: 00Z
source share