In [1]:
'hello you'.split()
Out[1]:
In [3]:
'hello | you'.split('|')
Out[3]:
In [9]:
# Doesn't seem to like more than one delimiter
'hello | you; and, me'.split(',|;')
Out[9]:
In [10]:
import re
In [13]:
# Pipe-separated delimiters
# Both "," and ";" are split on
re.split(',|;', 'hello | you; and, me')
Out[13]:
In [14]:
# What if you want to split on "|" too?
# Escape it: \|
re.split(',|;|\|', 'hello | you; and, me')
Out[14]: