I'm new to Python and so am confused by the following "list index out of range" error I get with the following code as my text file only contains 4 items in it which are first name, last name, hourly salary, total hours worked. Should this be changed to something that's not a while loop? If need be I can give the entire code. Any help would be greatly appreciated!
while line2 != "":
line2 = " "
line2 = line2.split( " " )
if (line2[ 0 ]+ " " + line2[ 1 ]) != name1.rstrip( " \n " ):
empFile3.write(line2[ 0 ] + " " + line2[ 1 ] + " " + line2[ 2 ] + " " + line2[ 3 ] + " \n " )