使用Python 3.6.4,我使用以下代码创建4个元素长列表的列表,每个列表包含整数。但是,不是创建所有4个不同元素列表的列表,而是仅由要附加到列表中的最后4个单词列表组成。这段代码中是否有任何错误,或者以这种规模在我的代码中使用append函数是否存在问题?任何帮助表示赞赏。
attemptList = []
dataCardList = []
currentAttempt = ""
alphabet = "abcdefghijklmnopqrstuvwxyz"
letter = 0
digit = 0
dataCard = [-1,-1,-1,-1]
while dataCard[0] <= 25:
dataCard[0] += 1
dataCard[1] = 0
dataCard[2] = 0
dataCard[3] = 0
dataCardList.append(dataCard)
print("17576 Cards Made")
while dataCard[1] <= 25:
dataCard[1] += 1
dataCard[2] = 0
dataCard[3] = 0
dataCardList.append(dataCard)
while dataCard[2] <= 25:
dataCard[2] += 1
dataCard[3] = 0
dataCardList.append(dataCard)
while dataCard[3] <= 25:
dataCard[3] += 1
dataCardList.append(dataCard)
print(dataCard)
print(dataCardList)