I have made a password prog to input the first line of the file as the password and then upon accessing the file the prog should ask the password and only if the password is right should the contents of the file be printed. But I just can’t get it to work. Pls help.
p=open("abc.txt", 'w+')
p.write("T") #< password
p.write("\n")
p.write("work pls")
p.close()
p=open("abc.txt", 'r+')
y=raw_input('pass')
if str(p.readline())==str(y):
print p.read()
else:
print "Password incorrect"
p.close()