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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -