Skip to content

Instantly share code, notes, and snippets.

@Centzilius
Created December 16, 2015 10:04
Show Gist options
  • Save Centzilius/f7ce46075b826aa8058b to your computer and use it in GitHub Desktop.
Save Centzilius/f7ce46075b826aa8058b to your computer and use it in GitHub Desktop.
# -*- 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