diff options
author | yaderv <yajosev@gmail.com> | 2011-03-22 15:43:27 (GMT) |
---|---|---|
committer | yaderv <yajosev@gmail.com> | 2011-03-22 15:43:27 (GMT) |
commit | 27c3a0ab2ec2b377f2300e42383fce1ff62b8c2c (patch) | |
tree | 9bafcec696471e9f991157b5d8412021c01c6d20 /archivo.py | |
parent | c93911fbeb281463d7663db4173260e4fc8cd0ed (diff) |
bug fixed
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] |