diff options
Diffstat (limited to 'archivo.py')
-rw-r--r-- | archivo.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -95,21 +95,23 @@ def abrir_archivo(path, archivo): archivo.close() return texto -def guardar_archivo(path, file_name, archivo): +def guardar_archivo(path, file_name, tipo_archivo): '''import, convert and save a new ephemeris/phrases database''' - if archivo is 1: + if tipo_archivo is 1: path = path + '/data/efemerides.pkl' - elif archivo is 2: + elif tipo_archivo is 2: path = path + '/data/frase.pkl' di = {} archivo = open(file_name, 'r') lines = archivo.readlines() for i in range(len(lines)): - current_text = lines[i][10 : len(lines[i]) - 2] - + if tipo_archivo is 1: + current_text = lines[i][10 : len(lines[i]) - 2] + else: + current_text = lines[i][4 : len(lines[i]) - 2] for j in range(30, len(current_text),30): current_text = current_text[:j] + '\n' + current_text[j:] - if archivo is 1: + if tipo_archivo is 1: current_id = lines[i][0 : 8] else: current_id = lines[i][0 : 2] |