擅长:python、mysql、java
<p>没有一个是直接的,但是可以使用<code>tempfile</code>和<code>shutil.copy2</code>的组合来实现相同的结果:</p>
<pre><code>import tempfile, shutil, os
def create_temporary_copy(path):
temp_dir = tempfile.gettempdir()
temp_path = os.path.join(temp_dir, 'temp_file_name')
shutil.copy2(path, temp_path)
return temp_path
</code></pre>
<p>不过,您需要处理删除调用者中的临时文件。</p>