import tempfile
tempfile.TemporaryFile() # 创建文件,返回文件对象
tempfile.NamedTemporaryFile() # 同上,不过会生成带有文件名的临时文件
tempfile.TemporaryDirectory() # 生成临时目录
tempfile.gettempdir() # 获取系统的临时目录。
tempfile.gettempdirb() # 与 gettempdir() 相同,只是该函数返回字节串。
tempfile.gettempprefix() # 返回用于生成临时文件的前缀名。
tempfile.gettempprefixb() #与 gettempprefix() 相同,只是该函数返回字节串