Δημοσιεύτηκε: 30 Σεπ 2011, 20:13
- Κώδικας: Επιλογή όλων
#!/bin/python3
import os.path
import pprint # "Pretty print"
try:
import cPickle as pickle
except ImportError:
import pickle
pickle_file = "crypt.db"
pickle_dict = dict()
# If pickle file exists
if os.path.exists(pickle_file):
with open(pickle_file, "rb") as f:
pickle_dict = pickle.load(f)
else:
f = open('crypt.db','w')
f.close()
def open_write:
name = input("ονομα; ")
pickle_dict["name"] = "name"
with open(pickle_file, "wb") as f:
pickle.dump(pickle_dict, f)