workshops:python_with_glue
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
workshops:python_with_glue [2012/01/22 14:53] – 62.235.231.149 | workshops:python_with_glue [2012/01/22 17:42] (current) – 62.235.231.149 | ||
---|---|---|---|
Line 5: | Line 5: | ||
BPython : cmdline python interpreter improved (w/ auto-completion, | BPython : cmdline python interpreter improved (w/ auto-completion, | ||
- | 2**3 # is 2 power 3\\ | + | <code python> |
+ | 2**3 # is 2 power 3 | ||
type(s) # returns the type of object s | type(s) # returns the type of object s | ||
+ | </ | ||
- | ==== mutable types and non-mutable types ==== | + | === mutable types and non-mutable types === |
- | Basic types are non-mutable: | + | Basic types are non-mutable: |
Mutable types: List (Array is a type of list) | Mutable types: List (Array is a type of list) | ||
- | + | ||
+ | <code python> | ||
+ | 0b00000001 # represents a binary number | ||
+ | </ | ||
+ | |||
+ | === Dictionaries === | ||
+ | You can put any type of object in a dictionary (not so much as a key, but as a value). A function can be put as a value in a dictionary. | ||
+ | |||
+ | === PPrint === | ||
+ | A python library for pretty printing. | ||
+ | |||
+ | === OOP === | ||
+ | <code python> | ||
+ | # Creating a class | ||
+ | class Hello: | ||
+ | def method(self): | ||
+ | return ' | ||
+ | |||
+ | # Or the now official way (compatible with python3) | ||
+ | class Hello(object): | ||
+ | pass | ||
+ | |||
+ | h = Hello() # Creates an instance of the class Hello | ||
+ | |||
+ | h.value1 = 23 # adds an attributes to the instance h | ||
+ | |||
+ | Hello.value2 = 45 # adds an attribute to the class and all its instances. | ||
+ | </ | ||
+ | |||
+ | You can add attributes and methods on the fly. | ||
+ | |||
+ | === Pyinotify === | ||
+ | A python module for monitoring filesystem changes | ||
+ | https:// | ||
+ | |||
+ | === Scapy === | ||
+ | http:// | ||
+ | Interactive packet manipulation program | ||
workshops/python_with_glue.txt · Last modified: 2012/01/22 17:42 by 62.235.231.149