Store lists inside of a list

+1 Arnab Banerjee · December 20, 2014
How to store lists inside of a list ?

Post a Reply

Replies

Oldest  Newest  Rating
+2 Simon Kvannli · December 21, 2014
You can also add a list inside a list after it is declared by:

list_d=[2,2]
list_c.append(list_d) 

print(list_c) then gives
[ [1,2], ["word"], [2,2] ]
+1 Vaggelis Theodoridis · December 20, 2014
list_a = [1,2]
list_b = ["word"]
list_c = [list_a, list_b]

print(list_c)
[[1,2], ["word"]]

# doesn't change anything, same way as you save strings,integers etc you save lists inside lists
0 Jesse Cox · December 21, 2014
You should look up the JSON standards. What you can do with them, you can do with Python.
  • 1

Python

107,241 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator