擅长:python、mysql、java
<p>您有<a href="https://docs.python.org/2/library/os.path.html#os.path.exists" rel="noreferrer">^{<cd1>}</a>函数:</p>
<pre><code>import os.path
os.path.exists(file_path)
</code></pre>
<p>这将返回文件和目录的<code>True</code>,但是您可以使用</p>
<pre><code>os.path.isfile(file_path)
</code></pre>
<p>测试它是否是一个特定的文件。它遵循符号链接。</p>