I need a quick help in RegEx, I need to convert some text into a particular text format.
Example text:
USD US Dollar 1.0000000000 1.0000000000
EUR Euro 0.8496903124 1.1768993778
GBP British Pound 0.7460341536 1.3404212062
There may be multiple lines.
I want that text to be converted to this format:
"First word" = "First number after the first word in the same line"
So the converted text would look like:
USD = 1.0000000000
EUR = 0.8496903124
GBP = 0.7460341536
Additionally, since I'm a complete newbie at Python and the fact that I have never used RegEx in Python (just read about it online), I would appreciate if you give me the entire sample script (i.e., including the import and etc.).
And also, I would appreciate if you could include that the numbers would be rounded off to two decimal digits.
Appreciate it.
And yes I'm playing around with trying to making a program for currency exchange. ;)
Example text:
USD US Dollar 1.0000000000 1.0000000000
EUR Euro 0.8496903124 1.1768993778
GBP British Pound 0.7460341536 1.3404212062
There may be multiple lines.
I want that text to be converted to this format:
"First word" = "First number after the first word in the same line"
So the converted text would look like:
USD = 1.0000000000
EUR = 0.8496903124
GBP = 0.7460341536
Additionally, since I'm a complete newbie at Python and the fact that I have never used RegEx in Python (just read about it online), I would appreciate if you give me the entire sample script (i.e., including the import and etc.).
And also, I would appreciate if you could include that the numbers would be rounded off to two decimal digits.
Appreciate it.
And yes I'm playing around with trying to making a program for currency exchange. ;)