如何在 Windows OS 而不是 `/tmp` unix 中存储文件?

How to store file in Windows OS instead of `/tmp` unix?

以下代码在unix-base系统上运行良好,并使用/tmp存储文件,但我如何在windows OS系列下使用它?

    local_filename, headers = urllib.request.urlretrieve('http://127.0.0.1/translations/python-3.7.3.exe')
    print(local_filename)
    fd = open(local_filename)
    fd.close()

来自文档:

Retrieve a URL into a temporary location on disk.

如果您不提供 filename 参数,那么 urlretrieve() 将调用 tempfile.NamedTemporaryFile() 在您的操作系统上临时文件的任何位置创建一个文件。这也适用于 Windows(文件将在 %TEMP% 下创建)。

如果您需要特定位置,请传递 filename 参数。