Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
Python for System administrator [OS Functions]
Friday, May 9, 2014
Intro
The OS Module in Python provides a good way to use the operation system functionality.
The functions provided allows to interface with the underlying OS that Python is running on (Windows, Mac or Linux).
Os Functions
♦ Executing a shell command : os.system()
♦ Get the status of a file: os.stat()
♦ Get the users environment: os.environ()
♦ Move to a different direcoty: os.chdir()
♦ Get current working directory: os.getcwd()
♦ Get the group Id of the current process: os.getgid()
♦ Get the current process's user id: os.getuid()
♦ Get the real process ID of the current process: os.getpid()
♦ Get the name of the user logged: os.getlogin()
♦ Check read permissions: os.getaccess()
♦ Change the mode of path to numeric mode: os.chmod()
♦ Change the owner and group id: os.chown()
♦ Set the current numeric unmask: os.umask(mask)
♦ Get the size of a file: os.getsize()
♦ Get the current environment: os.getenviron()
♦ Return informations about the operating system: os.uname()
♦ Delete the file path: os.remove(path)
♦ Remove the directory path: os.rmdir(path)
♦ Print out all directories, sub-directories and files: os.walk()
♦ Check if a path exists: os.path.exists()
♦ Get load average: os.getloadavg()
Django CHEAT SHEET [1.5]
Sunday, April 20, 2014
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Developed by a fast-moving online-news operation, Django was designed to handle two challenges: the intensive deadlines of a newsroom and the stringent requirements of the experienced Web developers who wrote it. It lets you build high-performing, elegant Web applications quickly.
open the picture in a new tab to enlarge
A collection of Python "Must Reads"
Monday, March 31, 2014
- http://wiki.python.org/moin/BeginnersGuide/Programmers
- A crash course into Python
- An Introduction to List Comprehensions in Python
Moved to Python from other languages:
- The Hitchhiker's Guide to Pyhton (It's open source, too: http://github.com/kennethreitz/python-guide/)
Python Style:
Python Books:
Python Classes:
- Intermediate and Advanced Software Carpentry in Python (2007)
- Google's Python class
- Introduction to Algorithms (with Python)
Python History:
- Guido Van Rossum's "Python History" blog (all of it!)
- Interfaces or Abstract Base Classes (2005)
- Of Python and Road Maps (or the lack thereof)
Another collection:
Python Setting UP:
Posts:
- The Python yield keyword explained
- Python's super() considered super!
- Understanding Python Decorators
- What is a metaclass in Python?
- Metaclasses Demystified
- Try/Catch for validation or speed?
- Python (and Python C API): __new__ versus __init__
- Python "self" keyword
- Python and the Principle of Least Astonishment
- A Curious Course on Coroutines and Concurrency
- Generator Tricks for Systems Programmers
- Code like a Pythonista: Idiomatic Python (2007)
- The entire Python Module of the week archive
- Also see the book - "Python Standard Library by Example"
- (By me) Python Threads and the global interpreter lock
- (By me) Get with the program as context manager
- How to write a Lisp interpreter in Python
- Unicode in Python, Completely Demystified
- Unicode for Dummies - Just use UTF-8
- Debugging in Python
- How to handle multiple inheritance of ABCs that implement each others abstract methods
- AOSA: Python Packaging
- 10 Reasons Python Rocks for Research (And a Few Reasons it Doesn’t)
- Beej's Guide to Network Programming
- How to use Linux epoll with Python
- Python beginner's Mistakes
- Command Line syntax: Some basic Concepts
- Be careful with exec and eval in Python
- Decorators make magic easy
- The detailed guide to "Timsort" (which Java adopted, FWIW)
- Notes on optimizing dictionaries
- Python Patterns - An Optimization Anecdote
- Python Performance Tips
- How-to guide for Python Descriptors
- Hidden Features of Python
- Python is Not Java (2004)
Python vs Ruby
Monday, March 31, 2014
Ruby is a dynamic, reflective, object-oriented general-purpose programming language which was designed and developed in the mid-1990s. Compared to Python, which treats code readability above everything else, the philosophy behind Ruby is that programmers should have the flexibility, freedom and power to write concise and compact code.
The most important difference between Python and Ruby is that the philosophy of Python requires almost everything explicitly defined by a programmer while Ruby allows the programmer to write code with implicit behaviour inherited from other components. For example, in Ruby, the self in instance methods is implicitly defined while Python requires self to be the first argument declared into an instance method.
In the example code above, the class Hello contains two instance methods hello() and call_hello(). Notice that Ruby's definition of call_hello() simply calls the hello() method without referring to self.hello() like Python's definition does.
source: http://www.pythoncentral.io/
Subscribe to:
Posts (Atom)








