Am 05.03.23 um 23:43 schrieb Stefan Ram:
   The following behaviour of Python strikes me as being a bit
   "irregular". A user tries to chop of sections from a string,
   but does not use "split" because the separator might become
   more complicated so that a regular expression will be required
to find it.

OK, so if you want to use an RE for splitting, can you not use re.split() ? It basically works like the built-in splitting in AWK

>>> s='alphaAbetaBgamma'
>>> import re
>>> re.split(r'A|B|C', s)
['alpha', 'beta', 'gamma']
>>>


        Christian
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to