Why You Should Looking at Python.

Python is an interpreted, interactive, object-oriented programming language. Python includes modules, classes, exceptions, very high level dynamic data types and dynamic typing. Python has also been one of the top 10 programming languages, since May of 2004 according toTiobe Software’s Programming Community Index. Python is being used by some big named companies such as Google, Yahoo, Walt Disney, and Industrial Light & Magic to name a few. Above all else the learning curve is simple.

Here is a quick script that show you how easy it is to connect to a MySQL Database

#!/usr/bin/python
# Import the MySQL Module
import MySQLdb
#Create the database connection
conn = MySQLdb.connect (host = “localhost”, user = “rhosto”, passwd = “biteme”, db = “test”)
#create and execute the sql query
cursor = conn.cursor()
cursor.execute (“SELECT VERSION()”)
#get and print out the results
row = cursor.fetchone ()
print “server version:”, row[0]
#close you database connection
cursor.close ()
conn.close ()

Leave a Reply