Lets say I do this
r = requests.get(url)
with open("file.py", "wb") as f:
f.write(r.content)
f.close
This will create and write the content of the file i requested into file.py But when I only does this
r = requests.get(url)
#and i run my code
Will it take up my pc storage if I keep on requesting but didn’t write it into a file
CodePudding user response:
When you run r = requests.get(url)
, the response will be stored in that variable, r. Any variable storing data will take up space on your computer, but not anything large enough to care about. If you run your code multiple times, the data in the variable r will just be overwritten. There is no reason to write data to an actual file unless you need to.
CodePudding user response:
If you do not write the content of the request into any file, your storage will not be affected. Your RAM is the one that holds the content from the request. RAM memory will only be used up by a program for as long as it runs. When your code finishes the RAM will be released.