所以我有两个for循环
for pokemon in pokemonList:
for key in pokemon:
print(key)
break
for files in os.walk("./sprites/"):
for filename in files:
print(filename)
我正在尝试使用第一个pokemonList.pokemon中的值重命名sprites文件夹中的文件
在Javascript id中,执行如下操作
for(i=0;i<pokemonList.length;i++){loop through both using i here}
但我不确定如何在python中实现这一点。先谢谢你
口袋妖怪列表:
[{'Milcery'}, {'Alcremie'}, {'Alcremie'}, {'Alcremie'}, {'Alcremie'}, {'Alcremie'}, {'Alcremie'}, {'Alcremie'}, {'Alcremie'}, {'Alcremie'}, {'Falinks'}, {'Pincurchin'}, {'Snom'}, {'Frosmoth'}, {'Stonjourner'}, {'Eiscue'}, {'Eiscue'}, {'Indeedee'}, {'Indeedee'}, {'Morpeko'}, {'Morpeko'}, {'Cufant'}, {'Copperajah'}, {'Dracozolt'}, {'Arctozolt'}, {'Dracovish'}, {'Arctovish'}, {'Duraludon'}, {'Dreepy'}, {'Drakloak'}, {'Dragapult'}, {'Zacian'}, {'Zacian'}, {'Zamazenta'}, {'Zamazenta'}, {'Eternatus'}, {'Eternatus'}]
您也可以使用索引:
在python中,可以通过使用方括号索引列表并使用len函数获取列表的长度来执行相同的操作:
在python中,列表索引从0开始
如果“口袋妖怪”和“文件”的范围相同,则可以将循环设置为
相关问题 更多 >
编程相关推荐