Created
February 26, 2023 05:14
-
-
Save YiLi225/931bd7fd8d455cb0d555b39ade5038df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Encrpyt the data file | |
# opening the key | |
with open('filekey.key', 'rb') as filekey: | |
key = filekey.read() | |
# using the generated key | |
fernet = Fernet(key) | |
# opening the original file to encrypt | |
with open('Wine_data.csv', 'rb') as file: | |
original = file.read() | |
# encrypting the file | |
encrypted = fernet.encrypt(original) | |
# opening the file in write mode and | |
# writing the encrypted data | |
with open('Wine_data_encrypted.csv', 'wb') as encrypted_file: | |
encrypted_file.write(encrypted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment