Apr-05-2021, 02:16 AM
And also move with open into the loop.
import requests domains = ['https://webdesigner.dk', 'https://www.dk4.dk/item/4128-persondatapolitik'] for domain in domains: print(domain) response = requests.get(domain) print(f"Response data length: {len(response.text)}") # Remove # from line below to see source # print(response.text) with open('source.html', 'a', encoding='utf-8') as f: f.write(response.text.strip())