Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99220

Re: using re.split function

From MRAB <python@mrabarnett.plus.com>
Newsgroups comp.lang.python
Subject Re: using re.split function
Date 2015-11-21 19:20 +0000
Message-ID <mailman.44.1448133667.2291.python-list@python.org> (permalink)
References <f810df9d-5691-467c-b212-7799dfdbb38d@googlegroups.com>

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

using re.split function david burstein <david007killer@gmail.com> - 2015-11-21 10:49 -0800
  Re: using re.split function MRAB <python@mrabarnett.plus.com> - 2015-11-21 19:20 +0000

csiph-web