forループ配列がtmp1から値を取得した後。後で使用するために値を保存するにはどうすればよいですか?
def getCardRank(self, arrays, straight = False):
print arrays
tmp1 = arrays[:]
tmp2 = {i: arrays[i] for i in range(0, len(arrays))}
print tmp1
for array in tmp1:
for card in array:
i = array.index(card)
mod = card % 13
if (mod == 0 and False != straight):
card = 0 if sum(array) == 27 else 13
else:
card = 13 if mod == 0 else mod
array[i] = card
print tmp1
print tmp2
それは私に与えます:
[[44, 43, 42, 41, 40], [37, 36, 35, 34, 33], [17, 16, 15, 14, 26]]
[[44, 43, 42, 41, 40], [37, 36, 35, 34, 33], [17, 16, 15, 14, 26]]
{0: [44, 43, 42, 41, 40], 1: [37, 36, 35, 34, 33], 2: [17, 16, 15, 14, 26]}
[[5, 4, 3, 2, 1], [11, 10, 9, 8, 7], [4, 3, 2, 1, 13]]
{0: [5, 4, 3, 2, 1], 1: [11, 10, 9, 8, 7], 2: [4, 3, 2, 1, 13]}