C
C
CTalbro2020-12-13 16:47:21
Python
CTalbro, 2020-12-13 16:47:21

Information from the site is not pulled out into a csv file (Parsin in python)?

from bs4 import BeautifulSoup
import csv

HOST = ' alegeri.md '

CSV = 'file.csv'

with open("index.html", "r") as f:
contents = f.read()
soup = BeautifulSoup(contents, ' lxml')
items = soup.find_all('tbody')

for i in range(1, 33):
wtf = soup.find_all('td', attrs={"data-sort-value": i})
wtf_s = soup .find('div', class_="rphoto").find('img').get('src')
wtf_ss = soup.find_all('td', class_='grey')
file = []
# w = soup.find('td', attrs={"data-sort-value": i}).find('div', class_="rphoto").find('img').get('src')
print(wtf)
print(wtf_s)
print(wtf_ss)
# print(w)

f = open('file.csv', 'w')
f.write([file])
f.close()

# with open('file.csv', mode='w') as file_csv :
# fieldnames = ['wtf', 'wtf_s', 'wtf_ss']
# writer = csv.DictWriter(file_csv, fieldnames=fieldnames)
#
# writer.writeheader()
# writer.writerow({'wtf': 'soup. find_all', 'wtf_s': 'soup.find', 'wtf_ss': 'soup.find_all'})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
malbaron, 2017-01-04
@malbaron

The motherboard does not generate electricity.
She just broadcasts it from the power supply. It's just wiring, tracks on the board.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question