Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Method to write data to python list
In [1]: l = list()
In [2]: type(l)
Out[2]: list
In [3]: l
Out[3]: []
In [4]: l.append(10)
In [5]: l.append('python-list')
In [6]: l
Out[6]: [10, 'python-list']
In [7]: old_list = [1, 2, 3, 4, 5]
In [8]: l.extend(old_list)
In [9]: l
Out[9]: [10, 'python-list', 1, 2, 3, 4, 5]
In [10]: l.append(old_list)
In [11]: l
Out[11]: [10, 'python-list', 1, 2, 3, 4, 5, [1, 2, 3, 4, 5]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.