STR="av1 avbV - 125
"Continuous numeric characters as an integer, five times after the replacement to the corresponding position
CodePudding user response:
Didn't you give the string case representative?If it is: STR="av1343 avbV - 125" how to replace the rules?
CodePudding user response:
import re
S="av1 avbV - 125
"
(x=re. Sub (r "? P\ d +) ", lambda x: STR (int (x.g roup (' num)) * 5), s)
Print (x)