12345678910111213 |
- def encryptFile():
- myFile = input("enter file to encrypt: ")
- file = open(myFile,"r")
- contents = file.read()
- contents = contents.encode()
- file = open(myFile, "w")
- encoded = base64.b64encode(contents)
- # the .decode() converts the bytes to str, taking off the b'...'
- file.write(str(encoded))
- print ("File is now encrypted... and the contents is unreadable")
|