using re.split function
MRAB
python at mrabarnett.plus.com
Sat Nov 21 14:20:55 EST 2015
On 2015-11-21 18:49, david burstein wrote:
> im pretty new in python and i didnt get how to use the re.split function.
> for example if i have a string and i want to split it by two conditions:
> first one splitting when " [ " appears second one when "]" appears
>
re.split(r" \[ |\]", string)
You need to escape the "[" because it normally indicates the start of a
character set.
More information about the Python-list
mailing list