Skip to content

Instantly share code, notes, and snippets.

@niranjrajasekaran
Last active May 27, 2019 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niranjrajasekaran/825c49be54ebda35d3f655e497121455 to your computer and use it in GitHub Desktop.
Save niranjrajasekaran/825c49be54ebda35d3f655e497121455 to your computer and use it in GitHub Desktop.
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