python - Compare raw_input to text in a file -
i learning python , trying play different functions. have created script match raw_input whats in file comes not matching. here script. can tell me doing wrong?
#this test script check password word = raw_input("what password ") #input data f = open("test.txt").read() if word == f: print "match" else: print "no match"
just sure remove new line or white space @ end of file. otherwise, use:
if word == f.rstrip(): ...
Comments
Post a Comment