Friday, April 8, 2016

Python List Access

If you have to use python, this is the kind of bullshit you have to put up with:

$ python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a=[1,2,3,4,5]
>>> a[2:]
[3, 4, 5]
>>> a[:2]
[1, 2]
>>> a[-2:]
[4, 5]
>>> a[:-2]
[1, 2, 3]

No comments:

Post a Comment

Weekly writing output

Wordcount graph
Powered by WritersDB.com