Everything related to syntax, tips and tricks and stuff
Define a List
["a", 1, "b", "c"]To check presence of an element:
array1 = ["a", "b", "c"]
"a" in array1 # True
array.index("b") # returns 1 - returns index of an element
array.index("f") # raises exceptionTo remove an element:
array2 = ["a", "b", "c"]
array2.remove("c")
#or
array.pop() # removes last elementCreate and access Dict
userid = {'john': 51, 'paul': 53}
print "paul usedid: ",userid['paul']
- dir()
- Sphinx - http://sphinx-doc.org/
- pydoc - http://epydoc.sourceforge.net/
- Doxygen - http://www.stack.nl/~dimitri/doxygen/
Example project documented with Sphinx: http://packages.python.org/an_example_pypi_project/sphinx.html