hello I'm trying to create program to check for the user password"only numbers" if it's correct then go to the next step. if not just type Invalid password
the password should be store in another file which is "password.txt"
this is my code but I couldn't make the program check the password from password.txt
import pickle f= open ("pin.txt", "w") pickle.dump(1234, f) pickle.dump([1,2,3,4], f) f.close() def passw(): f=open("password.txt", "r") x=pickle.load(f) pin = raw_input ("Please insert your password number: ") while True: if pin >= 1000: print "password accepted" if pin <= 9999: print "password accepted" print if pin == x: print "Valid password" print if pin != x: print "Invalid password" print else: print "Invalid password" passw()
thank you in advance