Jun-10-2018, 01:16 PM
my_text = """JEP Jersey Pound 0.7460790068 1.3403406220 TMT Turkmenistani Manat 3.4999999998 0.2857142857 TVD Tuvaluan Dollar 1.3155995656 0.7601097067 IMP Isle of Man Pound 0.7460790068 1.3403406220 GGP Guernsey Pound 0.7460790068 1.3403406220 ZMW Zambian Kwacha 10.2310718223 0.0977414700""" rows = my_text.split('\n') for row in rows: data = [item for item in row.split(' ') if item] print('{} = {:.2f}'.format(data[0], float(data[-2])))
Output:JEP = 0.75
TMT = 3.50
TVD = 1.32
IMP = 0.75
GGP = 0.75
ZMW = 10.23
(Jun-10-2018, 12:45 PM)Nwb Wrote: Ughm that's a bit confusing haha, you see I'm not that familiar with Python..No one was proficient when start learning new language. However you need to learn using docs if you want to prosper
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs