diff options
Diffstat (limited to 'archivo.py')
-rw-r--r-- | archivo.py | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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() + |