import rep = re.compile(r'\d+\.\d+\s+(\d{4})\b')s = "BEAVER COUNTY 001 0000 1010 BEAVER 2010 BEAVER COUNTY SCH DIST 0.008504 0.008508 4010 COUNTY SPECIAL SERVICE DIST NO.1 4040 BEAVER COUNTY 8005 GREENVILLE SOLAR 0.004258 0.008348 0.008238 4060 SPECIAL SERVICE DISTRICT NO 7"print(p.findall(s))
Standard input is empty
['4010', '4060']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!