python - Linecache adding an extra line to the line that i get -


when try line using linecache in python.

loginpass = raw_input("> ") if loginpass == linecache.getline('password.txt', 1): 

the line gets returns line. if line 1

"test" 

it returns

"test " 

it worked earlier in code after adds line after it.

this normal; reading lines file includes line-ending newline character. strip off:

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

i'm more concerned you're storing password in plain text, though....


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -