Convert string to a number

how to convert the string "1.217,000" to a number?

. stands for thousands and , for the decimal part...

Please provide a general answer for numbers formatted this way... thanks!
dfernanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
HonorGodConnect With a Mentor Commented:
Like this?
>>> s = '1.217,000'
>>>
>>> s.replace( '.', '' ).replace( ',', '.' )
'1217.000'
>>>
>>> float( s.replace( '.', '' ).replace( ',', '.' ) )
1217.0
>>>

Open in new window

0
 
dfernanAuthor Commented:
thx! great!
0
 
HonorGodCommented:
You are very welcome.

Thanks for the grade & points.

Good luck & have a great day.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.