Συντονιστής: konnn
#!/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)
def open_write(a_dict)
open_write(pickle_dict)
else:
f = open('crypt.db','w')
f.close()
#!/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)
def save():
pickle.dump(pickle_dict, f) # dump the object to a file
f.close()
def write( a_dict ):
name = input("ονομα; ")
pickle_dict["name"] = "name"
with open(pickle_file, "wb") as f:
pickle.dump(pickle_dict, f)
save()
def delete():
name = input("ονομα; ")
pickle_dict.pop("name")
save()
def menu():
n = input("τι θελετε να κανετε; ")
if n == 1:
write()
elif n == 2:
delete()
menu()
import os, pickle
pickle_file = "crypt.db"
pickle_dict = dict()
if os.path.exists(pickle_file):
with open(pickle_file, "rb") as f:
pickle_dict = pickle.load(f)
def save(something_to_save):
pickle.dump(something_to_save, f)
f.close()
def write(file_to_modify, file_to_save_to):
name = input("ονομα; ")
file_to_modify["name"] = "name"
with open(file_to_save_to, "wb") as f:
pickle.dump(file_to_modify, f)
save(file_to_modify)
def menu():
n = input("τι θελετε να κανετε; ")
if n == 1:
write(pickle_dict, pickle_file)