运行良好,但游戏列表中每个游戏的所有时间字段都会更新为最终值,例如所有4个“维克公园”游戏都显示2145,而不是4个单独的时间。你知道吗
class Game:
time = 0
team1 = ""
team2 = ""
class Field:
def __init__(self, numTimes = 0, name = "", daysAvail = 0):
self.numTimes = numTimes
self.games = [Game()] * numTimes
self.name = name
self.daysAvail = daysAvail
fieldList = []
fieldList.append(Field(4,"Vic Park", 5)) # 5 = monday and wednesday 0000101 base 2, lsb is monday, msb sunday
fieldList[0].games[0].time = 1800
fieldList[0].games[1].time = 1915
fieldList[0].games[2].time = 2030
fieldList[0].games[3].time = 2145
fieldList.append(Field(2,"Bannerman Park", 5))
fieldList[1].games[0].time = 1800
fieldList[1].games[1].time = 1915
目前没有回答
相关问题 更多 >
编程相关推荐