-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