有问题就先查一下官方文档,内容如下:
"""
tempfile.NamedTemporaryFile([mode='w+b'[, bufsize=-1[, suffix=''[, prefix='tmp'[, dir=None[, delete=True]]]]]])
This function operates exactly as TemporaryFile() does, except that the file is guaranteed to have a visible name in the file
system (on Unix, the directory entry is not unlinked). That name can be retrieved from the name attribute of the returned file-like
object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across
platforms (it can be so used on Unix; it cannot on Windows NT or later). If delete is true (the default), the file is deleted as
soon as it is closed.The returned object is always a file-like object whose file attribute is the underlying true file object.
This file-like object can be used in a with stat