I have problems with the following code:
file = open(\"file.txt\", \"r\") lines = file.readlines() print lines[0] print lines[1] print lines[2] file.close()
Do strip after each line. File has new line as last character. You have to remove it when you read it.
strip
print line[index].strip()