I've opened a new file via my IDE and turned it into a list via readlines. Why? Because I want to print them underneath each other. When I use
['Some name__________1.5 6.5 6.5\n', 'Another name________6.3 1.2 1.5\n']
1.5 3.5 4.5
2.5 3.5 4.5
5.5 3.5 4.5
fileFolder = open('TEXTFILE', 'r')
readFile = fileFolder.readlines()
for line in readFile:
line = line.split("_")
grades = line[-1]
grades = map(float,line[-1])
could not convert string to float: .
map is operating on each character of the string, because when you iterate over a string you get individual characters. You want to use another
split to get each number into separate strings.
grades = map(float, line[-1].split())