我正在创建一个游戏对象列表。我试图从objects_list中获取这些基本迭代,并将它们放入列表中的[[] [] [] [] [] []]列表,以对应6x6游戏网格。
All.objects_list.extend([Inert("dirt","filthy, dirty, dirt"),
Inert("trees","tall spindly trees"),
Inert("rocks","scatterd rocks"),])
我刚收到错误
Inert'对象不支持索引
for i in range(0,37):
for item in All.objects_list:
All.objects.append(item[i])
我可以为我的36个房间中的每个房间放置,删除和与列表迭代项目交互吗?
> Traceback (most recent call last): File
> "/private/var/mobile/Containers/Shared/AppGroup/EF18EB50-22D0-4A6B-A54C-1F9803851E30/Pythonista3/Documents/Text
> Adventures/ADVvX.py", line 603, in <module>
> All.objects.append(item[i]) TypeError: 'Inert' object does not support indexing