Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove thousands separator dot from the formatted numbers

Tags:

python

How can I remove the dot separator from formatted numbers? I'm getting a list from a website by using regular expression:

a = [10.000, 20.000, 25.000]

How can I change them to a = [10000, 20000, 25000]? (They're integers now).

like image 864
fish Avatar asked Nov 16 '25 13:11

fish


2 Answers

I am assuming what you have are strings, since you got them from a website, they should be text at first

>>> a=["10.000","20.000","25.000"]
>>> [ i.replace(".","") for i in a ]
['10000', '20000', '25000']
like image 130
ghostdog74 Avatar answered Nov 19 '25 02:11

ghostdog74


Use replace as this:

mystring.replace('.', '')
like image 41
joaquin Avatar answered Nov 19 '25 03:11

joaquin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!