My example will give false positive if there is a space before a comma. Or anything else by the conventions in the original string. I tried to keep it as simple as I could. If you want to catch a wider range of values you can use *simple* regular expression to catch as much spaces as you want. On Oct 1, 2015 3:48 PM, "Tim Chase" <python.l...@tim.thechases.com> wrote:
> On 2015-10-01 01:48, gal kauffman wrote: > > items = s.replace(' (', '(').replace(', ',',').split() > > s = "name1 (1)" > > Your suggestion doesn't catch cases where more than one space can > occur before the paren. > > -tkc > > > > -- > https://mail.python.org/mailman/listinfo/python-list >
-- https://mail.python.org/mailman/listinfo/python-list