How to extract the maximum numeric value from string in Python

1 Answer

0 votes
import re 

s = 'python1123php8923java134'
  
n = max(map(int, re.findall('\d+',s)))

print(n)  

         
      
'''
run:

8923
     

 



answered Apr 24, 2020 by avibootz

Related questions

...