-3
我仍在尝试为一个赋值创建一个代码,但遇到了一个空闲问题,告诉我object()不带参数,但是在代码中根本没有对象()。对象()在代码中没有参数但没有对象()
_world = {}
starting_position = (0, 0)
def load_tiles():
"""Parses file describing the world space in the _world object"""
with open("map.txt", 'r') as f:
rows = f.readlines()
x_max = len(rows[0].split('\t')) # believes all rows contains same amount of tabs
for y in range(len(rows)):
cols = rows[y].split('\t')
for x in range(x_max):
tile_name = cols[x].replace('\n', '')
if tile_name == 'StartingRoom':
global starting_position
starting_position = (x, y)
_world[(x, y)] = None if tile_name == '' else getattr(__import__('tiles'), tile_name)(x, y)
def tile_exists(x, y):
return _world.get((x, y))
你可以显示完整的跟踪? – Arun
我很愚蠢。你什么意思? – liam
控制台上印有什么? – Arun