#!/usr/bin/python
def AllocateMList(Dim):
if len(Dim)!=1:
tmp=[0]*Dim[0]
for i in range(Dim[0]):
tmp[i]=AllocateMList(Dim[1:])
return tmp
else:
return [0]*Dim[0]
#Specify Dimensions
PR=[3, 5, 7]
print "PR:", PR
#Allocate Multi-Dimensional List
TL=AllocateMList(PR)
print "TL:", TL
#Write access
TL[0][1][2]=787
print "write 787 to TL[0][1][2]"
#Check result
print "TL:", TL