Solved - ValueError: invalid literal for int() with base 10:

amount = '10,000'

# Convert to integer
amount_to_int = int(amount)

ValueError: invalid literal for int() with base 10: '10,000'

Solution:

amount = '10,000'

# Convert to integer
amount_to_int = int(amount.replace(',',''))
print(amount_to_int)

Comments

Popular posts from this blog

DVB Q&A

Comprehensive guide to Matplotlib

Solved - OSError("(10060, 'WSAETIMEDOUT')" in Requests package in Python