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

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -