Additions:
Additions:
To do so, we need to juggle with default dictionary
Additions:
 Nested dictionaries 
http://old.nabble.com/creating-a-nested-dictionary-td15061183.html∞
def deep_default_dict(level):
"
	This has been done to implement dict with several depths. 
	http://old.nabble.com/creating-a-nested-dictionary-td15061183.html
	"
if level < 1:
result = dict
while level > 1:
result = lambda: defaultdict(result)
level -= 1
return result
Deletions:
 django notes 
Create a project
django-admin.py startproject mysite
==Create a new app:==
Several apps can exist in the same project
(bash)
python manage.py startapp polls
Sync the view with the db
python manage.py syncdb
==Run the test server==
(bash)
python manage.py runserver 8080
 Show what SQL statements will be generated from models 
python manage.py sql appName
==Commit the databases changes to the database==
(bash)
python manage.py syncdb
Additions:
Commit the databases changes to the database
Additions:
 Show what SQL statements will be generated from models 
python manage.py sql appName
Additions:
Several apps can exist in the same project
Additions:
 django notes 
Create a project
django-admin.py startproject mysite
Deletions:
 django notes 
Additions:
 django notes 
Create a new app:
python manage.py startapp polls
==Sync the view with the db==
(bash)
python manage.py syncdb
Run the test server
%%(bash)
python manage.py runserver 8080
Additions:
 Not showing the password 
import getpass
password = getpass.getpass('Password: ')
Additions:
Additions:
Additions:
Additions:
 Length of an array 
myArray=[]
len(myArray)
Additions:
 Cast 
To cast to string type: 
i=0
print str(i)
Additions:
Additions:
Additions:
Additions:
ITTips
PythonTips
Install MySQLdb connector on Mac OSX
To install the python/
MySQL connector on Mac OS X follow the following tutorials:
MySQL connection
You have to create a cursor to connect to the database.
The cursor is created with 
MySQLdb.connect.
Then in the cursor class, you have a couple of methods:
-  execute(): to execute a mysql query
-  rowcount(): will return the number of lines of your sql query
-  fetchall(): get all the results from your sql query
-  fetchone(): method used to move forward through the resultset
2 ways to create sql queries and execute them:
sqlInsert = "insert into servers set servername='%s',location='%s',purpose='%s',live='%s',coderelease='%s'" % (servername,location,purpose,live,coderelease)
cursor.execute(sqlInsert)
 
cursor.execute("insert into servers set servername='%s',location='%s',purpose='%s',live='%s',coderelease='%s'" , (servername,location,purpose,live,coderelease)) 
The 1st one being the neater!
 methods definition 
When defining your class methods, you must explicitly list self as the first argument for each method, including 
init
built in functions 
http://docs.python.org/lib/built-in-funcs.html∞