Tried looking it up elsewhere, to no avail. How would I do something like, having Python read a file line, then use what's in that line as a variable for a different file?
Essentially, I want a different file that acts as a verification key, and when the content of the file (the passkey) is entered, my code recognizes that and passes it, then opening said file. I also want to be able to read a lockout file to check and see whether the user should be "locked out", and need to enter the passkey. Any possible way of doing this?
Update: I edited the code a little by my self, just so everyone is aware.
filename = ".UbuntuAlt/.Info.txt"
#I'm aware that the use of many of the "quit()" functions is ambiguous but idc
verify = ".UbuntuAlt/.Verify.txt"
locktxt = ".UbuntuAlt/.Lockout.txt"
#this is where I want to make ".Lockout.txt" verify whether the passkey needs to be used, and set variable "lockout" accordingly
infotxt = open(filename, "r")
verifyread = open(verify, "r")
locktestw = open(locktxt, "w")
locktestr = open(locktxt, "r")
if lockout == True:
verify1 = raw_input("Please enter verification key: ")
#this is where I want the code to read ".Verify.txt" and use its content as the passkey
if verify1 == "look above":
for line in infotxt:
print line,
infotxt.close()
verifyread.close()
lockout = False
#this is where I want ".Lockout.txt" edited to be false-- I can do that myself though
lockoutq = raw_input("Lockout is disabled. Reenable? [Y/n]: ")
if lockoutq == "y" or "Y" or " ":
#also where I plan on editing it
quit()
if lockoutq == "n" or "N":
quit()
else:
lockdownerr = raw_input("Invalid input. [2] attempts remaining. Reenable? [Y/n]: ")
if lockdownerr == "y" or "Y" or " ":
#aaa
quit()
if lockdownerr == "n" or "N":
quit()
else:
lockdownfinal = raw_input("Invalid input. [1] attempt remaining. Reenable? [Y/n]: ")
if lockdownerr == "y" or "Y" or " ":
#aaa
quit()
if lockdownerr == "n" or "N":
quit()
else:
print "Invalid input. Enabling anyway."
#you get the point
quit()
else:
verifyread.close()
print "You've inputted an invalid key. Aborting."
quit()
else:
for line in infotxt:
print line,
infotxt.close()
verifyread.close()
lockoutq2 = raw_input("Lockout is disabled. Reenable? [Y/n]: ")
if lockoutq2 == "y" or "Y" or " ":
#same as above w/ editing the lockout text
quit()
if lockoutq2 == "n" or "N":
quit()
else:
lockdownerr = raw_input("Invalid input. [2] attempts remaining. Reenable? [Y/n]: ")
if lockdownerr == "y" or "Y" or " ":
#aaa
quit()
if lockdownerr == "n" or "N":
quit()
else:
lockdownfinal = raw_input("Invalid input. [1] attempt remaining. Reenable? [Y/n]: ")
if lockdownerr == "y" or "Y" or " ":
#aaa
quit()
if lockdownerr == "n" or "N":
quit()
else:
print "Invalid input. Enabling anyway."
#you get the point
quit()