Wednesday, August 10, 2011

Some notes on Python

Data structures
* tuples - ( ) - inmutable
* lists - [ ] - changeable
* dictionary - { } changeable # Hash concept in Perl
   keys()
   values()
   __contains__(key)

* Strings are immutable

* None
* True
* False

To access the last element: [-1] # Same idea as in Perl

For lists:
   append()
   extend()
   pop(0) or pop() # The last element of the list is removed

No comments: