I am a Math tutor and I found the site https://www.yksityisopetus.fi/ where one can search pupils. I made a Python parser to find pupils that want Math teaching with at least 25 €/hour. Are there any improvements for this code?
import requests
import tkinter as tk
link = "https://www.yksityisopetus.fi/opiskelijat/matematiikka/min-25-per-tunti/uusin-ensin"
f = requests.get(link)
lista = f.text.split('\n')
ilmot = []
for i in range(len(lista)):
if "<a href=\"/" in lista[i] and "<a href=\"/opettajat" not in lista[i] and "<a href=\"/contact" not in lista[i]:
if lista[i] not in ilmot:
ilmot.append(lista[i])
parsittu = []
for i in range(len(ilmot)):
ilmo = "https://www.yksityisopetus.fi"+ilmot[i].split('"')[1]
f = requests.get(link)
f = f.text.split(">")
for j in range(len(f)):
if f[j] == '\n<br /':
parsittu.append(f[j+1])
s = ""
parsilmot = []
for i in range(len(parsittu)):
if parsittu[i].endswith('</div'):
parsilmot.append(parsittu[i][0:len(parsittu[i])-5])
p = list(set(parsilmot))
quote = ""
for i in p:
quote += i+"\n"
root = tk.Tk()
S = tk.Scrollbar(root)
T = tk.Text(root, height=4, width=100)
S.pack(side=tk.RIGHT, fill=tk.Y)
T.pack(side=tk.LEFT, fill=tk.Y)
S.config(command=T.yview)
T.config(yscrollcommand=S.set)
T.insert(tk.END, quote)
tk.mainloop()
BeautifulSoup
to parse the HTML. \$\endgroup\$ – Ken Y-N Jun 23 '20 at 0:11