demo_requests_response_iter_lines.py:
import requests url = 'https://www.w3schools.com/python/demopage.htm' x = requests.get(url) #return an iterator, one item for each line: print(x.iter_lines()) #looping through the iterator: for c in x.iter_content(): print(c)
C:\Users\My Name>python demo_requests_response_iter_lines.py
<<generator object Response.iter_lines at 0x04204DE0>
b'<!DOCTYPE html>'
b'<html>'
b'<body>'
b''
b'<h1>This is a Test Page</h1>'
b''
b'</body>'
b'</html>'