python - How to detect if string "_numbers" here -


i need detect, if string contains "_numbers", e.g.:

"4myluv3_27113.jpg" - true , "5cr00g3.jpg" - false , "joshua969.jpg"- false , "20comer100saber_lol.jpg" - false

the number may have 1 6 digits. answer!

use re.search

if re.search(r'_\d{1,6}\b', s): 

Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -