<jupyter_start><jupyter_text>HTML text auslesen<jupyter_code>r = requests.get("https://www.zahnarztvergleich.ch/zahnarzt.php?p=20&geschlecht=0")
r = r.text<jupyter_output><empty_output><jupyter_text>HTML Text auslesen und gleich abspeicher<jupyter_code>url = "https://www.zahnarztvergleich.ch/zahnarzt.php?p=20&geschlecht=0"
res = requests.get(url)
page_content = res.text
with open("test.html", "w") as file:
    file.write(r)
    file.close()<jupyter_output><empty_output><jupyter_text>4 verschiedene pages besuchen, und individuelle Files abspeichern<jupyter_code>#Zuerst die URLs bauen, wie wir besuchen
lst = ["20", "30", "40", "50"]
urllst = []
for number in lst:
    url = "https://www.zahnarztvergleich.ch/zahnarzt.php?p="+ number + "&geschlecht=0"
    urllst.append(url)
#Und jetzt den For Loop bauen, um alle URLs zu besuchen und die Inhalte rauszulesen.
number = 0
for page in urllst:
    page_content = requests.get(page)
    page_content = page_content.text
    with open(str(number)+".html", "w") as file:
        file.write(page_content)
        file.close()
    number +=1<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1368515205724508, 'fraction_numerical': 0.016100178890876567, 'mean_word_length': 5.286516853932584, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '511842', 'license': 'MIT', 'n_tokens_mistral': 448, 'n_tokens_neox': 440, 'n_words': 85, 'path': '12 Pandas Teil 4/uebungen_aus_projekten/Webpages besuchen mit Requests besuchen und den ganzen Code ablegen.ipynb', 'repo_name': 'manuelapaganini/20_21_Workfiles', 'size': '1118'}