python - Encrypt already saved files on a computer -
from string import maketrans intab = "abcdefghijklmnopqrstuvwxyz" outtab = "nopqrstuvwxyzabcdefghijklm" trantab = maketrans(intab, outtab) print "do want translate random term, or file?(please enter file name in code)" randorfile = raw_input ("type 1 enter custom term, or 2 translate whole file") if randorfile == "1": inputa = raw_input ("enter phrase translate") str = inputa print str.translate(trantab); elif randorfile == "2":
(code program) attempting create program encrypts file, , turns letters other letters, enigma machine (but more simple). have made can directly translate user entered phrases, top chunk of code shows, cant work out how translate made files on users computer.
the code meant go under "elif randorfile == "2"" line, cant work out how a) fetch data specified file on computer, , b) work out how translate file in program.
i have researched, cant find ways so. python skills beginner, if possibly quote relevant sources on this, helpful, although have tried, i'm not sure begin while looking through tutorial websites.
Comments
Post a Comment