擅长:python、mysql、java
<p>for循环将遍历文件并以最后一个文件结束。也就是说,x永远是你的最后一个文件。
如果要返回所有文件,需要创建一个列表并将所有文件保存在那里,如下所示:</p>
<pre><code>def out_fun():
array = [""]
for x in os.listdir('C:\Users\Guest\Desktop\OJT\scanner\samples_raw'):
array.append(x)
return '\n'.join(array)
</code></pre>