如何创建关联3D阵列数组?

时间:2015-08-23 10:08:31

标签: swift

我尝试创建Array 3D,但我仍然不知道如何创建一个?

import time

a = range(500)
sum(a)

bigrange = xrange(1000000)

for i in bigrange:
    pass

st = time.time()
sum(a)
print (time.time() - st) * 1e6

#Maintain a reference to bigrange to prevent it 
#being garbage collected earlier
print sum(bigrange)

1 个答案:

答案 0 :(得分:1)

这适用于Swift 2.0:

let array : [String : [String : Any]] = [
    "10001": [
        "last_index": 0, //Int
        "conteiner": [
            "id_from": 321 as Any, // Int
            "val2": "string text" as Any // String
        ]
    ]
]

array["10001"]?["last_index"]    // 0