Skip to content Skip to sidebar Skip to footer

Linecache Adding An Extra Line To The Line That I Get

When i try to get a line using linecache in python. loginpass = raw_input('> ') if loginpass == linecache.getline('Password.txt', 1): The line that it gets always returns with

Solution 1:

This is normal; reading lines from a file includes the line-ending newline character. Just strip it off:

linecache.getline('Password.txt', 1).rstrip('\n')

I'm more concerned that you're storing passwords in plain text, though....

Post a Comment for "Linecache Adding An Extra Line To The Line That I Get"