+ 1

Is there any way to produce a multidimensional list or dictionary or tuble as in arrays in c++

22nd May 2019, 3:11 PM
Vineet
Vineet - avatar
3 Antworten
+ 4
You can cram together almost whatever you want in Python, like: [(1, 2), {5: 6, 7:8}, 'ab', None, (3, 4, [7, 'blah'])]
22nd May 2019, 3:53 PM
HonFu
HonFu - avatar
+ 2
Of course : Liste = [ [0, 1], [2, 3] ] print(Liste[0][1]) #outputs 1
22nd May 2019, 3:18 PM
Théophile
Théophile - avatar
0
It works for tuples too. For dictionnaires : D = {"a" : {"a" : 2}} print(a["a"]["a"]) #outputs 2
22nd May 2019, 3:24 PM
Théophile
Théophile - avatar