for line in file: # for loop f = line.split() # turns line separated by whitespace into a list
(firstName, lastName, score1, score2, score3) = [t(s) for t,s in zip((str,str,int,int,int), f)]#zip #extracting fields into variable with the correct type. tuple
I don't know python but judging by the comments i can say it Splits a sentence like this one into a list of words and numbers and then takes those words or numbers and inputs them into a variable such as an integer or string. Are you learning to code?
I don't know python but judging by the comments i can say it Splits a sentence like this one into a list of words and numbers and then takes those words or numbers and inputs them into a variable such as an integer or string. Are you learning to code?