Created
December 16, 2015 10:04
-
-
Save Centzilius/f7ce46075b826aa8058b 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
# -*- coding: cp1252 -*- | |
# http://fishis.de/wiki/index.php/Verschl%C3%BCsselte_Pickle-Datei | |
import pickle | |
import base64 | |
def objekt_speichern(objekt, dateiname="pickle.txt"): | |
datei = file(dateiname, "w") | |
text = pickle.dumps(objekt) | |
chiffre = base64.b64encode(text) | |
pickle.dump(chiffre, datei, 0) | |
datei.close() | |
def objekt_laden(dateiname="pickle.txt"): | |
datei = file(dateiname, "r") | |
inhalt = pickle.load(datei) | |
datei.close() | |
print "Lesevorgang erfolgreich" | |
text = base64.b64decode(inhalt) | |
return pickle.loads(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment