From 8f59d01cb7718c9305a9fd747ff7993ef3918d1b Mon Sep 17 00:00:00 2001 From: yaderv Date: Wed, 23 Feb 2011 17:24:34 +0000 Subject: mark and unmark selected days --- (limited to 'archivo.py') diff --git a/archivo.py b/archivo.py index bd0b5be..1932e0f 100644 --- a/archivo.py +++ b/archivo.py @@ -157,7 +157,10 @@ def dict_meses(path, fecha=None): if fecha is not None: if indice in datos: - datos[indice].append(fecha) + if not fecha in datos[indice]: + datos[indice].append(fecha) + else: + pass else: datos[indice] = [] @@ -166,3 +169,16 @@ def dict_meses(path, fecha=None): pickle.dump(datos, f) f.close() return datos + +def borrar_dict_meses(path, fecha): + path = path + '/data/lista_dias.pkl' + indice = fecha[:4] + fecha = int(fecha[4:]) + f = open(path, 'rb+wb') + datos = pickle.load(f) + borrar = datos[indice].index(fecha) + del datos[indice][borrar] + f.seek(0) + pickle.dump(datos, f) + f.close() + -- cgit v0.9.1