[尝试创建for in循环时出现FileNotFoundError

问题描述 投票:0回答:1

我正在制作image classifier。我已经成功创建了文件夹,并手动将.txt files放置在每个文件夹内的linksimages的位置。

我现在正在尝试将download .txt file中的每个图像either放入每个文件夹类别内的文件夹or放入每个也具有.txt文件的类别文件夹 ,但是我不断出错。请帮助。

manually.txt files放在每个文件夹中,就像它们在父文件夹名称中一样,是PLANTS,但这没有什么区别。

我希望从带有Google图像链接的.txt文件中将所有图像下载到其各自的文件夹中,但是无论.txt是在PLANTS主文件夹中还是在PLANTS文件夹中的每个类别文件夹中,它都无法正常工作

相反,我得到以下错误

FileNotFoundError

请参阅附件的屏幕截图

enter image description here

enter image description here

python-3.x jupyter-notebook google-colaboratory fast-ai
1个回答
0
投票

Windows NT中的NTFS支持长文件名或带空格的路径。但是,在命令提示符操作中指定它们时,这些文件名或目录名称必须在其两边加上引号。无法使用引号导致错误消息。

for i in range(len(folders)):
    path = "content/gdrive/My Drive/Colab Notebooks/Flowers/PLANTS"
    dest = path+"/"+folders[i]

注意:更好的做法是在不使用space more info]的情况下写入文件夹/文件名

© www.soinside.com 2019 - 2024. All rights reserved.