Ayuda con WEB SCRAPING de una tabla
Publicado por Natixis (2 intervenciones) el 07/02/2019 00:55:00
Hola, necesito de su ayuda, estoy haciendo web scraping a una tabla y la estoy guardando en un archivo de texto, sin embargo no consigo eliminar el codigo html.
Este es mi codigo:
Este es mi codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import time
from tabulate import tabulate
import requests
from bs4 import BeautifulSoup
response = requests.get('http://www.bcra.gov.ar/PublicacionesEstadisticas/Historial-Leliq.asp')
soup = BeautifulSoup(response.text, 'html.parser')
titulo = soup('table', {"class": 'table table-BCRA table-bordered table-hover table-responsive'})
data = titulo[0].find_all('tr')
table = (tabulate(data, tablefmt='f'))
f = (open('C:\Phyton_Projects\LELIQ'+time.strftime("%Y%m%d_%H%M")+'.txt', "w"))
for row in table:
f.write("%s" % row)
f.close()
print("Termina Proceso")
Valora esta pregunta
0