或者,如果在Linux中,请尝试:
# To save to an absolute path.r = requests.get(url) with open('/path/I/want/to/save/file/to/file_name.pdf', 'wb') as f: f.write(r.content)# To save to a relative path.r = requests.get(url) with open('folder1/folder2/file_name.pdf', 'wb') as f: f.write(r.content)有关更多详细信息,请参见open()函数文档。



