How to read only number from a specific line using python script -


how read number specific line using python script example

"1009 run test jobs" here should read number "1009" instead of "1009 run test jobs"

a simple regexp should do:

import re match = re.match(r"(\d+)", "1009 run test jobs") if match:     number = match.group() 

https://docs.python.org/3/library/re.html


Comments