Question: How to convert currency to float or integer and vice versa in Python? 1) s = 7,508,339 USD how to delete the comma and USD
How to convert currency to float or integer and vice versa in Python?
1)
s = "7,508,339 USD"
how to delete the comma and USD and change it to 7508339
2) Also, if we have an number like 23345.456, how to convert it to a string? "23,345.456 USD"
especially, for commas, it should be added every three digits for the integer part. if the length of the number is not certain, what should be done to solve this problem?
Is there any package in Python can solve this problem automatically?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
