As that string has extra double quotes,can do tricks and match between quotes.
For testing regex look at regex101.
There also a Regular Expression HOWTO and the regular doc.
For testing regex look at regex101.
There also a Regular Expression HOWTO and the regular doc.
>>> import re >>> >>> line2 = '"555 102 4 21", "39 555 6", "555 102"' >>> r = re.findall(r'"(.*?)"', line2) >>> r ['555 102 4 21', '39 555 6', '555 102'] >>> r[0] '555 102 4 21' >>> [int(i) for i in r[0].split()] [555, 102, 4, 21] >>> # Or think of why this work,hint new PEP >>> g = r[0].replace(' ', '_') >>> g '555_102_4_21' >>> int(g) 555102421 # No error using underscore in integer >>> 100_000_000_123 100000000123