I started working on python and I'm currently stuck on this concept, and its kind of hard to explain so I'll use an example.
Example:
I have a txt file containing: France,210026,63929000,1.15
I have already figured out how to split the elements and add them to the list. But I want to add the numbers as floats and the country name as a string.
Currently what I do is:
inf = []
with open('small.txt', 'r') as inputFile:
for line in inputFile:
line = line.strip()
if line != '':
info += line.split(',')
print info
the output is:
['France', '210026' , '63929000', '1.15']
As you can see this is a list of strings. Want I actually want is for only France to be the string, the rest should be floats. Any ideas?
Thanks