<p>我有大约10分钟的视频,只是提取到每一帧,所以我有超过100000的图像在我的文件夹中,并将它们从1重命名为100000。现在,我想从1到100000的图像中每30个选择一个,并将它们移到另一个文件夹。例如:1、31、61、91121151181等等</p>
<p>这是我目前的代码:</p>
<pre><code>import os
import shutil
PATH = './Folder1/'
DEST = './Folder2/'
file = 1
for file in os.listdir(PATH):
file = file + 30
shutil.copyfile(PATH, DEST)
</code></pre>
<p>但它给了我以下错误:</p>
<pre><code>---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-b08091703697> in <module>
9 # Get a list of files in the current working directory
10 for file in os.listdir(PATH):
---> 11 file = file + 30
12 shutil.copyfile(PATH, DEST)
TypeError: can only concatenate str (not "int") to str
</code></pre>
<p>提前感谢您的帮助</p>