0

that's my code:

string = "ID:abc, NAME:ABC"
re.findall("ID:(...)|NAME:(...)", string)

butthis code gives me [('abc', ''), ('', 'ABC')] while I want to get the results in this form (list): ["abc", "ABC"]. What should I change? I don't want to split it into two separate lines like re.findall("ID:(...)", string) + re.findall("NAME:(...)", string)

Mr.Hedge
  • 17
  • 4

0 Answers0