CONVERTIR="pdftotext -layout -nopgbrk " if (platform.system()=="Linux"): PROCESAR="./procesar_tabla.py " BORRAR="rm " if (platform.system()=="Windows"): PROCESAR="procesar_tabla.py " BORRAR="del " FICH_RESULTADO="resultado.csv" CONCAT="cat " ficheros_pdf=glob.glob("*.pdf") for f in ficheros_pdf: nuevo_nombre=gf.reemplazar_espacios(f) gf.renombrar_fichero(f, nuevo_nombre) ficheros_pdf=glob.glob("*.pdf") for f in ficheros_pdf: nombre_con_txt=f[:-4]+".txt" if not gf.existe_fichero(nombre_con_txt): #print ("No existe:"+nombre_con_txt) gf.aplicar_comando(CONVERTIR, f) ficheros_txt=glob.glob("*.txt") for f in ficheros_txt: gf.aplicar_comando(PROCESAR, f)
def crear_objeto (dni_pasado, ap1, ap2, nombre_pasado, email_pasado, sexo_pasado, fecha_nac_pasada, domicilio_pasado, localidad_pasada, cp_pasada, provincia_pasada, iban_pasado, ccc_pasado): return GaseoWeb( dni=dni_pasado,apellido_1=ap1, apellido_2=ap2, nombre=nombre_pasado ) path =os.path.dirname(os.path.abspath ( __file__ )) gf=GestorFicheros() zip_ref = zipfile.ZipFile("Afiliados.zip", 'r') zip_ref.extractall(path) zip_ref.close() #gf.borrar_fichero ( "Afiliados.zip") descriptor_fichero=open ("Afiliados.xls", "r") gf.renombrar_fichero ( "Afiliados.xls", "Afiliados.html") fichero=open("Afiliados.html") sopa = BeautifulSoup ( fichero, "html.parser") tbody=sopa.find("tbody") filas=tbody.find_all("tr") objetos=[] for fila in filas: celdas=fila.find_all("td") dni = celdas[0].text nombre = celdas[2].text ap1 = celdas[3].text ap2 = celdas[4].text email = celdas[6].text sexo = celdas[8].text fecha_nac = celdas[9].text