I have a txt file which looks like this:
100.00 gasoline
20.00 lunch
12.50 cigarettes
I want to take only the numbers (100.00, 20.00, 12.50) and append them to a list, how can I do it? I tried with:
tot_us = []
for float in us_file:
tot_us.append(float)
When I print the list i get:
['100.00\tgasoline\n', '20.00\tlunch\n', '12.50\tcigarettes\n']
I was expecting:
['100.00', '20.00', '12.50']
I know is a noob attempt, how can I solve this?