擅长:python、mysql、java
<p>在
如果它可能会对某人有所帮助,我想或多或少地做同样的事情,下面是我使用的代码:</p>
<pre><code>import os
from tempfile import NamedTemporaryFile
def UmaskNamedTemporaryFile(*args, **kargs):
fdesc = NamedTemporaryFile(*args, **kargs)
umask = os.umask(0)
os.umask(umask)
os.chmod(fdesc.name, 0o666 & ~umask)
return fdesc
</code></pre>