The coding that I am using to learn:
import requests
r = requests.get("http://google.com")
f = open("./page.html", "w+")
f.write(r.text)
So if i understand all right this will create a .html file and write the google.com html code that i request (r) in it.
If i run this now:
import requests
params = {"q": "pizza"}
r = requests.get("http://google.com/search", params=params)
f = open("./page.html", "w+")
f.write(r.text)
Does the f.write(r.text)
rewrite everything that's on 'r' variable like it was a blank file or it will just edit the file with new stuff i add into 'r'? didn't knew how to ask. Thanks
EDIT: nevermind I am a noob! use f = open("./page.html", "a")
if i want to append and 'w' if i want to overwrite