Python type conversion

Asked 2 years ago, Updated 2 years ago, 144 views

I'd like to change the value received by crawling the website to int with the string ex : 1,551 consisting of numbers I don't think I can convert to int because of comma. error message : Could not convert string to int: '1,551'

I need help with how to convert

python casting

2022-09-22 18:37

1 Answers

ID Yeopto wrote this, but...

Let's move on to run it right away.

a = '1,551'
a = int(a.replace(',', ''))
print(a)


2022-09-22 18:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.