how can use regular expressions parse <listname>[#] [listname, #]?
here's i've tried:
> s = 'li[10]' > re.split(s,r'[%d]') ['[%d]'] > re.findall(s,r'[%d]') [] > s.split(r'[%d]') ['li[0]'] the desired output li , 10
how (.*)\[(.*)\]?
re.findall("(.*)\[(.*)\]", s) # [('li', '10')]
Comments
Post a Comment