Issue
import requests
from bs4 import BeautifulSoup
url = 'https://www.universitego.com/bilgisayar-muhendisligi-2021-taban-puanlari-ve-basari-siralamalari/'
soup = BeautifulSoup(requests.get(url).content.decode('utf-8', 'ignore'), 'html.parser')
for span in soup.select('tr > td:nth-child(1)'):
print(span.get_text(strip=True, separator=' '))
print('-' * 80)
I used the above code to get departments and tables about the department from below websites. However, I got an empty list after I run. What should I do? Thank you.
Websites https://www.universitego.com/4-yillik-bolumlerin-2015-2016-taban-puanlari-ve-basari-siralamalari/ https://www.universitego.com/bilgisayar-muhendisligi-2021-taban-puanlari-ve-basari-siralamalari/
Solution
here u go
from bs4 import BeautifulSoup
from requests import get
r=get('https://www.universitego.com/bilgisayar-muhendisligi-2021-taban-puanlari-ve-basari-siralamalari/')
soup=BeautifulSoup(r.content, features='lxml')
resulting_list_of_dicts=[]
keys=soup.find('table').find('tbody').findAll('tr')[0].text.split('\n')
for values in [i.text for i in soup.find('table').find('tbody').findAll('tr')[1:]]:
resulting_list_of_dicts.append(dict(zip(keys,values.split('\n'))))
resulting_list_of_dicts[0]
'Üniversite Adı':'BOĞAZİÇİ ÜNİVERSİTESİ (İSTANBUL) (Devlet Üniversitesi)'
'Bölüm':'Bilgisayar Mühendisliği (İngilizce)'
'Puan Türü':'SAY'
'Kont.':'85'
'Taban Puanı':'546,34716'
'Başarı Sırası':'643'
Answered By - Pozdniakov Filipp
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.