擅长:python、mysql、java
<pre><code>import glob
g=glob.glob("*") #This selects every file in directory, if you want the only the ones starting with "temps", then write "temps*"
for index, line in enumerate(g):
print(g)
#do stuff with files here
</code></pre>
<p>g是你的文件列表。最后一个for循环就是在它们上面循环。这有用吗?你知道吗</p>
<h2>评论后修改</h2>
<p>这对我很有用:</p>
<pre><code>import glob
g=[]
for x in range(inputdata):
select = "*"+str(x)
exp_g=glob.glob(select)
g.extend(exp_g)
g
</code></pre>