How to parse comma-separated number to int in Python

1 Answer

0 votes
s = '49,371,007'
 
n = int(s.replace(',',''))
 
print(n)
print(type(n))
 
 
 
  
  
'''
run:
  
49371007
<class 'int'>

'''

 



answered Jun 22, 2021 by avibootz

Related questions

...