If dir is specified, the file will be created in that directory; otherwise, a default directory is used. The default directory is chosen from a platform-dependent list, but the user of the application can control the directory location by setting the TMPDIR, TEMP or TMP environment variables.
If tempdir is unset or None at any call to any of the above functions, Python searches a standard list of directories and sets tempdir to the first one which the calling user can create files in. The list is:
The directory named by the TMPDIR environment variable.
The directory named by the TEMP environment variable.
The directory named by the TMP environment variable.
A platform-specific location:
On RiscOS, the directory named by the Wimp$ScrapDir environment variable.
On Windows, the directories C:\TEMP, C:\TMP, \TEMP, and \TMP, in that order.
On all other platforms, the directories /tmp, /var/tmp, and /usr/tmp, in that order.
在贝壳上试试这个
这将显示python正在使用的实际临时路径。
你可以选择试试这个。(这将产生与上述相同的结果)
查看文件句柄上的} (在*NIX系统上)的情况下,您将看到} 。
.name
确实是查看文件存在位置的一种方法。在^{<fdopen>
,表示打开的文件句柄,但没有相应的目录项。如果要保留到基础文件的链接,则需要使用^{如果要控制临时文件的位置,请查看
dir
参数:^{} 使用^{} ,这允许使用
dir
参数设置目录:调用^{} function :
如果要影响临时文件的创建位置,可以通过将^{} value 设置为不同的目录来更改临时文件的创建位置。引用文档,如果该值为
None
,则规则如下:相关问题 更多 >
编程相关推荐