When you use Tm = [[0]*8]*24 you are creating 24 alias copies of an eight zero list. That means all 24 sublists have the same memory address.
To create the proper list of lists use this approach:
# create a 24 by 8 list of lists initialized with zero
zerolist24x8 = []
for x in range(24):
# create a fresh list of 8 zeros 24 times
zerolist8 = []
for y in range(8):
zerolist8.append(0)
zerolist24x8.append(zerolist8)
Now you can use module copy to make your copy of zerolist24x8, for instance:
import copy
Tm = copy.deepcopy(zerolist24x8)
Tr = copy.deepcopy(zerolist24x8)