Answers for "split string in double tab python"

2

python split string by tab

>>> import re
>>> strs = "footbarttspam"
>>> re.split(r't+', strs)
['foo', 'bar', 'spam']
Posted by: Guest on December-12-2020
0

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']
Posted by: Guest on January-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language