Custom Search

Saturday, April 30, 2011

Howto upgrade from Ubuntu 10.xx to Ubuntu 11 Natty Narwhal

The next Ubuntu version 11.04 Natty Narwhal is coming soon (The final stable version will be released end April 2011), if you intend to upgrade to 11.04 from current Ubuntu version there are few ways you can choose including online and offline upgrading. If you have ubuntu 10.10 Maverick Meerkat or older version of ubuntu installed and you want to upgrade to the latest Ubuntu 11.04 Natty Narwhal, you can do it by following these instructions.

Safety Precaution
To be safe:
# Make a full backup of your data on an external device (USB stick or CD/DVD).
# Download and burn the liveCD of the newer release, and check that your hardware is fully functional with it.

Desktop Online Upgrade
1# Press Alt+F2
2# type in “update-manager -d”
3# Finally click “Upgrade” and follow the on-screen instructions.

Server Online Upgrade
1# install the update-manager-core package if it is not installed:
$ sudo apt-get install update-manager-core

2# Edit /etc/update-manager/release-upgrades and set Prompt=normal;
$ sudo nano /etc/update-manager/release-upgrades
Then set “Prompt=normal;”
(remember to save it)

3# Launch the upgrade tool:
$ sudo do-release-upgrade -d
(follow the on-screen instructions)

Offline upgrading via Live-CD
Since Ubuntu 11.04 Natty, Ubuntu Live-CD supports upgrading from the previous Ubuntu installation. Download the Ubuntu 11.04 iso and create a Live-CD or Live-USB, then boot from the device, if you have a Ubuntu installed on machine there’s an upgrade option in the installation guide.

Thursday, April 28, 2011

howto python read a file and reverse it

howto python read a file and reverse it

fp1 = open("test-1", "r")
lines = fp1.readlines()
lines.reverse()

fp2 = open("test-2", "w")
fp2.writelines(lines)

fp1.close()
fp2.close()

Tuesday, April 26, 2011

python how to find even/odd numbers from a list using list comprehension and Filter

python how to find even/odd numbers from a list using list comprehension and Filter
my_list = [1,2,3,4,5,6,7,8,9,10]

#find even/odd numbers from a list using list comprehension
even_list = [x for x in my_list if not x%2]
odd_list = [x for x in my_list if x%2]
print "\n-------even_list--------", even_list
print "\n-------odd_list--------", odd_list

=========================

#find even/odd numbers from a list using Filter
even_list = filter(lambda x:not x%2, my_list)
odd_list = filter(lambda x:x%2, my_list)
print "\n-------even_list--------", even_list
print "\n-------odd_list--------", odd_list

=========================

def even_check(x):
if not x%2:
return True
return False

def odd_check(x):
if not x%2:
return False
return True

#find even/odd numbers from a list using Filter
even_list = filter(even_check, my_list)
odd_list = filter(odd_check, my_list)
print "\n-------even_list--------", even_list
print "\n-------odd_list--------", odd_list


OUTPUT
======
-------even_list-------- [2, 4, 6, 8, 10]

-------odd_list-------- [1, 3, 5, 7, 9]

-------even_list-------- [2, 4, 6, 8, 10]

-------odd_list-------- [1, 3, 5, 7, 9]

-------even_list-------- [2, 4, 6, 8, 10]

-------odd_list-------- [1, 3, 5, 7, 9]

how to measure execution time of functions using decorator

how to measure execution time of functions using decorator

from time import time

#decorator def
def timed(f):
def wrapper(*args, **kwds):
start = time()
result = f(*args, **kwds)
elapsed = time() - start
print "%s took %d time to finish" % (f.__name__, elapsed)
return result
return wrapper


#function def
@timed
def test():
for i in range(1,20000000):
a=0



#call
test()


OUTPUT
========
test took 1 time to finish

Monday, April 18, 2011

python boolean tricks

isSelected = True
result = ('not-selected', 'selected')[isSelected]
print "-------result------", result
#it indexes the tuple with isSelected.

isSelected = False
result = ('not-selected', 'selected')[isSelected]
print "-------result------", result


isSelected = 1
result = ('not-selected', 'selected')[isSelected]
print "-------result------", result
#it indexes the tuple with isSelected.

isSelected = 0
result = ('not-selected', 'selected')[isSelected]
print "-------result------", result

Output
=====
-------result------ selected
-------result------ not-selected
-------result------ selected
-------result------ not-selected

Multiplying string with boolean

str1 = "selected"
isSelected = True
result = str1 * isSelected
print "-----result------", result

isSelected = False
result = str1 * isSelected #get empty string
print "-----result------", result
print "-----type(result)------", type(result)

Output
=====
-----result------ selected
-----result------
-----type(result)------type 'str'>

python Recursive function to find power


def power(a, b):
if b==0:
return 1
return a*power(a, b-1)

print "----power---",power(6,2)


#OR


def power(a, b):
if b==0:
return 1
result = a*power(a, b-1)
return result

print "----power---",power(2,5)


Output
=======
----power--- 36
----power--- 32

python does not support static variable

Python does not have "static variables" in precisely the same sense that C++ or Java do. It does have class attributes.

there is no such thing AFAIK, the closest is a class variable

Also, @staticmethod is nearly useless. @classmethod is a little more useful

Sunday, April 17, 2011

python set operations on dictionaries

Python does not support set operations on dictionaries.

python set operations examples

>>> a = set([1,2,3,4])
>>> b = set([3,4,5,6])
>>> a | b # Union
{1, 2, 3, 4, 5, 6}
>>> a & b # Intersection
{3, 4}
>>> a < b # Subset False >>> a - b # Difference
{1, 2}
>>> a ^ b # Symmetric Difference
{1, 2, 5, 6}

More...

python raise statement with argument and with no argument difference


1) python raise statement with argument.

try:
5 / 0
except Exception, e:
raise e

Output
=====
Traceback (most recent call last):
File "del me.py", line 5, in
raise e
ZeroDivisionError: integer division or modulo by zero

===================

2) python raise statement with no argument.

try:
5 / 0
except Exception, e:
raise e

Output
=====
Traceback (most recent call last):
File "del me.py", line 3, in
5 / 0
ZeroDivisionError: integer division or modulo by zero



how to add 3rd party python modules (how to modify python search path)

how to add 3rd party python modules
how to modify python search path

1) Use PYTHONPATH environment variables

2) Add symlinks in their site-packages directories.

3) Add directories in their site-packages directories.

4) Another way, is to use *.pth files

The most convenient way [to modify python's search path] is to add a path configuration file to a directory that's already on Python's path, usually to the .../site-packages/ directory. Path configuration files have an extension of .pth, and each line must contain a single path that will be appended to sys.path. (Because the new paths are appended to sys.path, modules in the added directories will not override standard modules. This means you can't use this mechanism for installing fixed versions of standard modules.

python Named string formatting example

python Named string formatting example

my_dict = {'foo': 'answer', 'bar':42}
print "The %(foo)s is %(bar)i." % my_dict

#New Style Formatting
print("The {foo} is {bar}".format(foo='answer', bar=42))

OUTPUT
=======
The answer is 42.
The answer is 42

python Conditional Assignment trick

x = 3 if (y == 1) else 2

Assign 3 to x if y is 1, otherwise assign 2 to x.
Note that the parens are not necessary, but I
like them for readability. You can also chain it if
you have something more complicated:

x = 3 if (y == 1) else 2 if (y == -1) else 1

python implement your own (read-only) version of property using descriptors.

python implement your own (read-only) version of property using descriptors.
When you use dotted access to look up a member (eg, x.y),
Python first looks for the member in the instance dictionary.
If it's not found, it looks for it in the class dictionary.
If it finds it in the class dictionary, and the object
implemented the descriptor protocol, instead of just
returning it, Python executes it. A descriptor is any class
that implements the __get__, __set__, or __del__ methods.
Descriptors are used in Python to implement properties,
bound methods, static methods, class methods and slots,
amongst other things.


class Property(object):
def __init__(self, fget):
print "\n----__init__---fget---", fget
self.fget = fget

def __get__(self, obj, type):
print "\n----__get__---obj---", obj
print "\n----__get__---type---", type
if obj is None:
return self
return self.fget(obj)


class MyClass(object):
@Property
def foo(self):
print "-----foo------"
return "Foo.....!"

print "\n-------start-------"
m1 = MyClass()
print "\n--------m1--------", m1
print "\n-----m1.foo-----", m1.foo

OUTPUT
======
----__init__---fget---

-------start-------

--------m1-------- <__main__.MyClass object at 0x7f155505a090>

-----m1.foo-----
----__get__---obj--- <__main__.MyClass object at 0x7f155505a090>

----__get__---type---
-----foo------
Foo.....!


More...


Saturday, April 16, 2011

python Dictionaries get method use

Dictionaries have a 'get()' method.
If you do d['key'] and key isn't there, you get an exception.
If you do d.get('key'), you get back None if 'key' isn't there.
You can add a second argument to get that item back
instead of None, eg: d.get('key', 0).

It's grate for adding up numbers:

sum[value] = sum.get(value, 0) + 1

how to python look up for a member

how to python search for member

When you use dotted access to look up a member (eg, x.y), Python first looks for the member in the instance dictionary. If it's not found, it looks for it in the class dictionary. If it finds it in the class dictionary, and the object implemented the descriptor protocol, instead of just returning it, Python executes it.

python Creating new types at runtime

Creating new types at runtime

>>> NewType = type("NewType", (object,), {"x": "hello"})
>>> n = NewType()
>>> n.x
"hello"

which is exactly the same as

>>> class NewType(object):
>>> x = "hello"
>>> n = NewType()
>>> n.x
"hello"

python Function argument unpacking


def test(x, y):
pass

args1 = (3, 4)
args2 = {'y': 3, 'x': 2}

test(*args1)
test(**args2)

python for else statements

The "else" block will be normally executed at the end of the for loop or the break is called or list is empty.

lst = [1,2,0,3,4]
for x in lst:
print "-----for-----",x
else:
print "----else----", x

Output
====
-----for----- 1
-----for----- 2
-----for----- 0
-----for----- 3
-----for----- 4
----else---- 4

=============

lst = []
for x in lst:
print "-----for-----",x
else:
print "----else----", x

Output
====
----else----
Traceback (most recent call last):
File "del me.py", line 8, in
print "----else----", x
NameError: name 'x' is not defined



python iterate over the whole list in 2 increments

The step argument in slice operators

a = [1,2,3,4,5]
>>> a[::2]
[1,3,5]

python Be careful with mutable default arguments

Be careful with mutable default arguments

>>> def foo(x=[]):
... x.append(5)
... print x
...
>>> foo()
[5]
>>> foo()
[5, 5]
>>> foo()
[5, 5, 5]

Instead, you should use.

>>> def foo(x=None):
... if x is None:
... x = []
... x.append(5)
... print x
>>> foo()
[5]
>>> foo()
[5]

create an iterator that print each character in a file until it returns

create an iterator that print each character in a file
until it returns '\n'.
#create an iterator that calls f.read(1) until it returns '\n'.
#syntax: iter(callable, sentinel) -> iterator;
the callable is called until it returns the sentinel


def next_line(f):
for c in iter(lambda: f.read(1),'\n'):
print "------->", c

fp = open('test_file', 'r')

next_line(fp)

#Suppose file 'test_file' contain line 'hello'

Output
=====
------->h
------->e
------->l
------->l
------->o

Thursday, April 14, 2011

firefox tricks and shortcuts

firefox tricks and shortcuts

Ctrl + Shift + T = Reload Closed Tab

Ctrl + Shift + R = Reload Web Page, Override Cache

Ctrl + Shift + Tab = Go Backwards When Scrolling Through Tabs (right to left)

Ctrl + Shift + G = Find Toolbar searches page backwards (down to up)

Ctrl + Shift + Del = Clear Private Data

Ctrl + Shift + D = Bookmark All Open Tabs

User Submitted Ctrl + Shift Shortcuts

Ctrl+Shift+Enter = Adds .org to the end of an address in the address bar

(thanks to Jian Li)

Ctrl + Shift + B = Organize Bookmarks

Ctrl + Shift + E = Adblockplus addon preferences

Ctrl + Shift + F = Foxmarks Addon settings

Ctrl + Shift + H = Show Browsing History

Ctrl + Shift + J = Firefox Error Console

Ctrl + Shift + L = Open selected links using the Linky addon

Ctrl + Shift + Q = Foxclock addon Zone Picker

Ctrl + Shift + S = Synchronize books using Foxmarks Addon

Ctrl + Shift + V = Show items blockable with the Adblockplus addon

Ctrl + Shift + W = Close the current window

Ctrl + Shift + X = toggle typing direction of current textbox

Ctrl + 1 through 9 = Quick switch between 9 open tabs

Ctrl + Page Up = Move left through your open tabs

Ctrl + Page Down = Move right through your open tabs

Ctrl + P = Print Screen

Ctrl + O = Open File

Ctrl + I = Open Bookmarks in Sidebar

Ctrl + U = View Source

Ctrl + T = Open an Empty New Tab

Ctrl + R = Reload web page

Ctrl + E = Move Cursor to Search Bar

Ctrl + W = Close tab (if no tabs open, then closes browser)

Ctrl + Tab = Move right through your open tabs

Ctrl + S = Open “Save As…”

Ctrl + D = Bookmark This Page

Ctrl + F = Open the Find bar for searching the web page

Ctrl + H = Open History in Sidebar

Ctrl + J = Open the Download Manager

Ctrl + K = Move Cursor to Search Bar

Ctrl + L = Move Cursor to Address Bar

Ctrl + B = Open Bookmarks in Sidebar

Ctrl + N = Open a New Firefox Window

Tuesday, April 12, 2011

Python tricks Boolean type

Python tricks Boolean type

The simplest built-in type in Python is the bool type, which can hold only one of two possible objects: True or False:

>>> b = True
>>> type(b)

>>> id(b)
1055887

Because there are only two possible values, the Boolean type is unique. The Python interpreter provides the only two bool objects needed: True and False. Anytime these objects are needed in a Python program, the variable just references one as appropriate.

>>> b = True
>>> id(b)
1055552
>>> bb = b
>>> id(bb)
1055552
>>> bb = True
>>> id(bb)
1055552

The case for the name of the Boolean object is important because true (and false) is undefined:

Python create Generator object using yield range xrange

Python create Generator object using yield range xrange

All python programmers are familiar with for-loops, and their ability to iterate over a list. What some programmers may not know, is that you can also use generator functions.

For instance, take the humble range function, which returns a list of incremental numbers. This is useful enough in some cases, but less useful when used in a for-loop that will run for thousands of iterations:

for i in range(10000):
# do something

This function is rather inefficient, as it generates a list of 10'000 numbers before it even begins the loop, using up a lot of memory and CPU time. So how can this be improved?

An easy way is to use a generator function and the yield keyword:
def quick_range(x):
i = 0
while i < x:
yield i
i += 1

for i in quick_range(10000):
# do something

Due to the yield keyword, quick_range returns a generator object when called. This generator object has a function called next() that returns i each time it is called. When the loop ends, a StopIteration exception is thrown.

This generator function can be used in for loops in much the same way as a list is. It's also faster, since there is no need to allocate memory for a 10'000 member list.

Because iterating over large numbers is a common problem, Python supplies the xrange function, which is similar in nature to the quick_range function, as supplied above. Using xrange when dealing with large numbers can dramatically increase the efficiency of your program.

Python Parallel sorting of lists

Python Parallel sorting of lists

Sometimes you want to sort a list, and there's a second list (of the same length) which should be sorted along with it. Of course, you could have used a single list of 2-tuples in the first place, but sometimes a program requires a different structure. Anyway, it's easy. The following snippet works with two or more lists (the example shows only two).

data = zip(list1, list2)
data.sort()
list1, list2 = map(lambda t: list(t), zip(*data))

Note that zip() returns a list of tuples, so you have to convert the result of the last zip() back to lists. That's what the map() command along with the lambda function does. If you don't actually need lists, the last line could be simplified like this:

tuple1, tuple2 = zip(*data)

python how to get current username windows linux

python how to get current username windows linux

import os
user_name = os.getusername()

------------------OR

import getpass
user_name = getpass.getuser()

------------------OR

Combine os.getuid() with pwd.getpwuid().

import os
import pwd
user_name = pwd.getpwuid( os.getuid() )[ 0 ]


http://docs.python.org/library/pwd.html

------------------OR

import os
user_name = os.getlogin()

Monday, April 11, 2011

python how to get home directory

python how to get current user home directory or folder

import os
home_dir = os.path.expanduser("~")

OR

home_dir = os.getenv('USERPROFILE') or os.getenv('HOME')

Sunday, April 10, 2011

python how to download a file over http

from urllib import urlretrieve

def callback(blocknum, blocksize, totalsize):
print "Downloaded " + str((blocknum * blocksize)),
print " of ", totalsize

urlretrieve("http://www.example.com/my_file.pdf", "my_file.pdf", callback)
print "Download Complete"

Saturday, April 9, 2011

list of all python packages

list of all python packages

Play with Bluetooth

  • python-bluez - Python wrappers around BlueZ for rapid bluetooth development
  • python-lightblue - cross-platform Bluetooth API for Python
  • python-obexftp - Python binding to the object exchange file transfer library


Play with Pdf Files

  • python-reportlab - ReportLab library to create PDF documents using Python
  • chm2pdf - A Python script that converts CHM files into PDF files
  • python-pdftools - PDF document reading classes
  • python-pisa - PDF generator using HTML and CSS (Python module)
  • python-pypdf - PDF toolkit implemented solely in Python
  • python-trml2pdf - Converter of Report Markup Language (RML) file to PDF

Play with Image

  • python-image-store-proxy - Image Store Proxy for the Canonical Image Store
  • python-imaging-tk - Python Imaging Library - ImageTk Module
  • python-aafigure - ASCII art to image converter
  • python-djvu - Python support for the DjVu image format
  • python-exactimage - fast image manipulation library (Python bindings)
  • python-insighttoolkit3 - Image processing toolkit for registration and segmentation - Python bindings
  • python-pythonmagick - Object-oriented Python interface to ImageMagick
  • python-stepic - Python Steganography in Images
  • python-vipscc - image processing system good for very large images (tools)
  • python-imaging - Python Imaging Librarypython-imaging-sane - Python Imaging Library - SANE interface
  • python-imaging-tk - Python Imaging Library - ImageTk Module

neuroimaging

  • python-nipy - Analysis of structural and functional neuroimaging data
  • python-nipype - Neuroimaging data analysis pipelines in Python

Play with OpenOffice/LibreOffice

  • python-openoffice - Python libraries for interacting with OpenOffice.org
  • ooo2dbk - converts OpenOffice.org SXW documents to DocBook XML
  • python-uno - Python-UNO bridge

Latex

  • python-twisted-lore - Documentation generator with HTML and LaTeX support
  • python-plastex - LaTeX document processing framework in Python
  • python-plastex-doc - LaTeX document processing framework in Python - documentation files

Play with XML

  • python3-markupsafe - XML/HTML/XHTML Markup safe string for Python3
  • python-4suite-xml - An open-source platform for XML and RDF processing
  • python-amara - Amara is a pythonic XML toolkit
  • python-chameleon - XML-based template compiler
  • python-genshi - Python XML-based template engine
  • python-jaxml - Python module for generating XML documents
  • python-junitxml - PyUnit extension for reporting in JUnit compatible XML
  • python-kid - simple Pythonic template language for XML based vocabularies
  • python-libxml2 - Python bindings for the GNOME XML library
  • python-lxml - pythonic binding for the libxml2 and libxslt libraries
  • python-markupsafe - XML/HTML/XHTML Markup safe string for Python
  • python-meld3 - An HTML/XML templating system for Python
  • python-musicbrainz2 - An interface to the MusicBrainz XML web service
  • python-plist - Library for handling Apple binary and XML property lists
  • python-pygccxml - specialized XML reader reads the output from gccxml
  • python-pyside.qtxml - Qt 4 XML module - Python bindings
  • python-rdflib - RDF library containing an RDF triple store and RDF/XML parser/serializer
  • python-xmltv - allows Python applications to access XMLTV data

Games

  • python-2play - peer-to-peer network game engine
  • python-ocempgui - graphical user interface toolkit providing widgets for PyGame
  • python-pygame - SDL bindings for games development in Python
  • python-rabbyt - sprite library for Python with game development in mind
  • python-renpy - framework for developing visual-novel type games - Python module
  • python-tofu - high-level network game engine for Python

Facebook/Twitter

  • python-facebook - Python wrappers for the Facebook API
  • python-twitter - Twitter API wrapper for Python
  • python-twyt - interface to Twitter API functions for Python
  • python-skype - Skype API wrapper for Python

Play with Network

  • python-libpcap - python libpcap wrapper
  • python-pcapy - Python interface to the libpcap packet capture library
  • python-pypcap - object-oriented Python interface for libpcap
  • python-nmap - Python interface to the Nmap port scanner
  • python-scapy - Packet generator/sniffer and network scanner

SVG

  • python-rsvg - Python bindings for the RSVG library
  • pyjamas-canvas - Pyjamas Python port of GWTCanvas SVG Library
  • python-pyside.qtsvg - Qt 4 SVG module - Python bindings

Play with OGG

  • python-ogg - Python interface to the Ogg library
  • python-pyvorbis - Python interface to the Ogg Vorbis library


Open Zip Files

??

Do Math with Python

  • python-mpmath - library for arbitrary-precision floating-point arithmetic
  • python-numeric - Numerical (matrix-oriented) Mathematics for Python

Audio

  • python-farsight - Audio/Video communications framework: Python bindings
  • python-mutagen - audio metadata editing library
  • python-pyao - A Python interface to the Audio Output library
  • python-pyao-dbg - A Python interface to the Audio Output library (debug extension)
  • python-alsaaudio - Alsa bindings for Python
  • python-aubio - python interface for aubio, a library for audio segmentation
  • python-gnuradio-audio-alsa - Python bindings for GNU Radio ALSA audio driver
  • python-gnuradio-audio-jack - GNU Radio Python JACK Audio Driver
  • python-gnuradio-audio-oss - GNU Radio Python OSS Audio Driver
  • python-gnuradio-audio-portaudio - GNU Radio Python PortAudio Driver
  • python-gnuradio-qtgui - Python bindings for GNU Radio ALSA audio driver
  • python-pymad - Python wrapper to the MPEG Audio Decoder library

Video

  • python-farsight - Audio/Video communications framework: Python bindings
  • python-freej - realtime video mixer and linear video editor
  • python-gnuradio-video-sdl - GNU Radio SDL Interface Library
  • python-libmimic - A video codec for Mimic V2.x content (python bindings)

Multimedia

  • python-gst0.10 - generic media-playing framework (Python bindings)
  • python-mediaprofiles - Python bindings for the GNOME media profiles library
  • python-kaa-metadata - Media Metadata for Python
  • python-liblicense - Python bindings for library to analyze media files' license info
  • python-mlt2 - multimedia framework (python bindings)
  • python-mmkeys - Multimedia key support as a PyGTK object
  • python-moovida - Python library for the Moovida media center application
  • python-pgm - User interfaces with embedded multimedia - Python bindings
  • python-pyglet - cross-platform windowing and multimedia library
  • python-pyxine - interface to the xine media player for Python
  • python-sfml - Simple and Fast multimedia library - Python Bindings

Database

  • python-pgsql - A Python DB-API 2.0 interface to PostgreSQL v7.x
  • python-mysqldb - A Python interface to MySQL
  • python-sqlite - python interface to SQLite 2
  • python-apsw - another Python SQLite 3 wrapper
  • python-pysqlite2 - Python interface to SQLite 3
  • python-migrate - Database schema migration for SQLAlchemy
  • python-pymongo - Python interface to the MongoDB document-oriented database
  • python-pymssql - Python database access for MS SQL server and Sybase
  • python-pyodbc - Python module for ODBC database access
  • python-redis - Persistent key-value database with network interface (Python library)
  • python-sprox - Python library to generate web widgets from database schemas
  • python-sqlobject - object relational manager providing an object interface to your database
  • python-tables - hierarchical database for Python based on HDF5
  • python-testrepository - Database of test results - python library
  • python-tz - Python version of the Olson timezone database
  • python-whisper - database engine for fast, reliable fixed-sized databases
  • python-zodb - Set of tools for using the Zope Object Database (ZODB)

Slides

  • python-slides - Python-based Slide Maker

Plot

  • python-chaco - interactive plotting application toolkit
  • python-gnuplot - A Python interface to the gnuplot plotting program
  • python-matplotlib - Python based plotting system in a style similar to Matlab
  • python-plplot - Python support for PLplot, a plotting library
  • python-pybiggles - Scientific plotting package for Python
  • python-qwt3d-qt4 - Python bindings of the QwtPlot3D library
  • python-viper - minimalistic scientific plotter and run-time visualization module

JavaScript

  • pyjamas - Python web widget toolkit and Python-to-Javascript compiler
  • pyjamas-pyjs - Pyjamas Python-to-Javascript compiler
  • python-jswebkit - WebKit/JavaScriptCore Python bindings
  • python-slimmer - HTML, XHTML, CSS, JavaScript optimizer
  • python-tgmochikit - The MochiKit JavaScript library as a TurboGears widget

WebKit

  • python-webkit - WebKit/Gtk Python bindings
  • python-jswebkit - WebKit/JavaScriptCore Python bindings
  • python-pastewebkit - port/reimplementation of Webware WebKit in WSGI and Paste
  • python-pyside.qtwebkit - Qt 4 WebKit module - Python bindings

PySide

  • python-pyside - Python bindings for Qt4 (big metapackage)
  • python-pyside.phonon - Qt 4 Phonon module - Python bindings
  • python-pyside.qtcore - Qt 4 core module - Python bindings
  • python-pyside.qtdeclarative - Qt 4 Declarative module - Python bindings
  • python-pyside.qtgui - Qt 4 GUI module - Python bindings
  • python-pyside.qtnetwork - Qt 4 network module - Python bindings
  • python-pyside.qtopengl - Qt 4 OpenGL module - Python bindings
  • python-pyside.qtscript - Qt 4 script module - Python bindings
  • python-pyside.qtsql - Qt 4 SQL module - Python bindings
  • python-pyside.qtsvg - Qt 4 SVG module - Python bindings
  • python-pyside.qttest - Qt 4 test module - Python bindings
  • python-pyside.qtuitools - Qt 4 UI tools module - Python bindings
  • python-pyside.qtwebkit - Qt 4 WebKit module - Python bindings
  • python-pyside.qtxml - Qt 4 XML module - Python bindings

OpenGL

  • python-opengl - Python bindings to OpenGL
  • python-pyside.qtopengl - Qt 4 OpenGL module - Python bindings
  • python-qt4-gl - Python bindings for Qt4's OpenGL module

HTTP

  • python-httplib2 - comprehensive HTTP client library written for Python
  • python-twisted-web - An HTTP protocol implementation together with clients and servers
  • python-twisted-web2 - An HTTP/1.1 Server Framework
  • python3-httplib2 - comprehensive HTTP client library written for Python3
  • pygopherd - Modular Multiprotocol Gopher/HTTP/WAP Server in Python
  • python-django-swordfish - Persistent key-value database with HTTP interface (Django integration)
  • python-lazr.restful - Publish Python objects as RESTful resources over HTTP
  • python-restkit - HTTP resource kit for Python
  • python-sesame - Python wrapper for Sesame's REST HTTP API

CSS

  • python-cssutils - CSS Cascading Style Sheets parser and builder
  • python-pisa - PDF generator using HTML and CSS (Python module)
  • python-slimmer - HTML, XHTML, CSS, JavaScript optimizer

JQuery

  • python-pyquery - jQuery-like library for python


Widget and GUI

  • Please HELP to fix errors...
  • python-pyglet - cross-platform windowing and multimedia library
  • pybootchartgui - boot sequence visualisation
  • pychess - chess graphical user interface for several chess engines
  • pyjamas-gchart - Pyjamas Python port of GWT GChart Charting and Graph Widget Library
  • pyjamas - Python web widget toolkit and Python-to-Javascript compiler
  • pyjamas-ui - Python Pyjamas Web Widget Set library
  • pypibrowser - graphical interface for browsing the Python Package Index
  • pyro-gui - graphicals tool for Pyro
  • python3-sqlalchemy - SQL toolkit and Object Relational Mapper for Python 3
  • python-abiword - Python AbiWidget and TableWidget wrappers
  • python-albatross-common - Toolkit for Stateful Web Applications (common files)
  • python-albatross - Toolkit for Stateful Web Applications
  • python-amara - Amara is a pythonic XML toolkit
  • python-aptdaemon-gtk - Python GTK+ widgets to run an aptdaemon client
  • python-avc - live connection among widgets and application variables
  • pythoncard-tools - wxPython-based GUI construction framework (optional development tools)
  • pythoncard - wxPython-based GUI construction framework (meta-package)
  • python-carquinyol-0.88 - Sugar graphical shell - datastore
  • python-chaco - interactive plotting application toolkit
  • python-champlain-gtk - A Gtk+ widget to display maps (Python bindings)
  • python-dialog - Python module for making simple Text/Console-mode user interfaces
  • python-django-tinymce - replacement text widget for Django web framework
  • python-dnspython - DNS toolkit for Python
  • python-dogtail - GUI test tool and automation framework
  • python-elementary - Python bindings for the Elementary widget set library
  • python-fltk - Python wrapper for the Fast Light Toolkit
  • python-galago-gtk - GTK+ widgets for the Galago presence library (Python interface)
  • python-gaphas - diagramming widget
  • python-gnuradio-qtgui - Python bindings for GNU Radio ALSA audio driver
  • python-gnuradio-wxgui - GNU Radio Graphical Interface Routines based on wxPython
  • python-gtk2 - Python bindings for the GTK+ widget set
  • python-gtksourceview2 - Python bindings for the GtkSourceView widget
  • python-gtk-vnc - A VNC viewer widget for GTK+ (Python binding)
  • python-gucharmap - Unicode browser widget library (shared library)
  • python-hachoir-wx - wxWidgets GUI for the hachoir binary parser
  • python-ifeffit - Python GUI interface and extensions for IFEFFIT
  • python-insighttoolkit3 - Image processing toolkit for registration and segmentation - Python bindings
  • python-jarabe-0.88 - Sugar graphical shell - library
  • python-kiwi - a graphical framework to construct simple UI
  • python-kwwidgets - Cross-Platform GUI Toolkit - Python
  • python-launchpadlib-toolkit - convenience library for launchpadlib
  • python-m2crypto - a crypto and SSL toolkit for Python
  • python-mapnik - C++/Python toolkit for developing GIS applications (Python)
  • python-mdp - Modular toolkit for Data Processing
  • python-ocempgui - graphical user interface toolkit providing widgets for PyGame
  • python-packagekit-gtk - Python GTK+ widgets for PackageKit clients
  • python-pmw - Pmw -- Python MegaWidgets
  • python-pp - parallel and distributed programming toolkit for Python
  • python-pyke - Prolog-inspired Python logic programming toolkit
  • python-pypdf - PDF toolkit implemented solely in Python
  • python-pyside.qtgui - Qt 4 GUI module - Python bindings
  • python-pythoncard - wxPython-based GUI construction framework (underlying Python libraries)
  • python-qwt5-qt4 - Python version of the Qwt5 technical widget library
  • python-reportlab-accel - C coded extension accelerator for the ReportLab Toolkit
  • python-simpy-gui - python-based simulation package, GUI
  • python-spread - simple Python wrapper module for the Spread toolkit
  • python-sprox - Python library to generate web widgets from database schemas
  • python-sqlalchemy-ext - SQL toolkit and Object Relational Mapper for Python - C extension
  • python-sqlalchemy - SQL toolkit and Object Relational Mapper for Python
  • python-sugar-0.88 - Sugar graphical shell - core functionality
  • python-sugar-toolkit-0.88 - Sugar graphical shell - core widgets
  • python-tegaki-gtk - GTK+ widget Python model for Tegaki
  • python-tgmochikit - The MochiKit JavaScript library as a TurboGears widget
  • python-tk - Tkinter - Writing Tk applications with Python
  • python-toscawidgets - Python framework for building reusable web components
  • python-traitsbackendqt - PyQt backend for Traits and TraitsGUI (Pyface)
  • python-traitsbackendwx - WxPython backend for Traits and TraitsGUI (Pyface)
  • python-traitsgui - Traits-capable windowing framework
  • python-ubuntuone - Ubuntu One widget library
  • python-urwid - curses-based UI/widget library for Python
  • python-vte - Python bindings for the VTE widget set
  • python-wxglade - GUI designer written in Python with wxPython
  • python-wxgtk2.8 - wxWidgets Cross-platform C++ GUI toolkit (wxPython binding)
  • python-wxtools - wxWidgets Cross-platform C++ GUI toolkit (wxPython common files)
  • python-wxversion - wxWidgets Cross-platform C++ GUI toolkit (wxPython version selector)
  • python-zope.browser - Shared Zope Toolkit browser components
  • python-zope.catalog - Cataloging and Indexing Framework for the Zope Toolkit

NumPy

  • python-numpy - Numerical Python adds a fast array facility to the Python language
  • python-numpy-ext - NumPy adds a fast array facility to the Python language
  • python-symeig - Symmetrical eigenvalue routines for NumPy

USB

  • python-ftdi - Python module to control and program the FTDI USB controller
  • python-usb - USB interface for Python

Charts

  • pybootchartgui - boot sequence visualisation
  • pyjamas-gchart - Pyjamas Python port of GWT GChart Charting and Graph Widget Library
  • python-gdchart2 - Python OO interface to GDChart
  • python-graphy - chart generation library for Python
  • python-pycha - chart-drawing library using Cairo
  • python-pychart - Python library for creating high quality charts
  • python-pygooglechart - complete wrapper for the Google Chart API

Google

  • pyjamas-gmap - Pyjamas Google Maps (v3) Wrapper Library
  • python-gdata - Google Data Python client library
  • python-gflags - Python implementation of the Google command line flags module
  • python-pygooglechart - complete wrapper for the Google Chart API

PyJamas

  • pyjamas - Python web widget toolkit and Python-to-Javascript compiler
  • pyjamas-canvas - Pyjamas Python port of GWTCanvas SVG Library
  • pyjamas-gchart - Pyjamas Python port of GWT GChart Charting and Graph Widget Library
  • pyjamas-gmap - Pyjamas Google Maps (v3) Wrapper Library
  • pyjamas-pyjs - Pyjamas Python-to-Javascript compiler
  • pyjamas-ui - Python Pyjamas Web Widget Set library

Clutter

  • python-clutter - Open GL based interactive canvas library - Python bindings
  • python-clutter-gtk - Python bindings for Clutter-Gtk

Physics

  • python-box2d - Python Bindings for the 2D Physics Engine Box2D
  • python-elements - A 2D Physics API for Python

IBUS

  • python-ibus - New input method framework using dbus

Dbus

  • python-dbus - simple interprocess messaging system (Python interface)
  • python-qt4-dbus - DBus Support for PyQt4

Text

  • python-cheetah - text-based template engine and Python code generator
  • python-egenix-mxtexttools - fast text processing tools for Python
  • python-aeidon - reading, writing and manipulating text-based subtitle files
  • python-dialog - Python module for making simple Text/Console-mode user interfaces
  • python-django-markupfield - custom Django field for easy use of markup in text fields
  • python-django-tinymce - replacement text widget for Django web framework
  • python-html2text - Python module for converting HTML to Markdown text
  • python-markdown - text-to-HTML conversion library/tool
  • python-ooolib - Python module for creating OpenDocument documents (sp.sheet/text)
  • python-pastebin - Python module to send text files to pastebin web applications
  • python-polib - Python library to parse and manage gettext catalogs
  • python-progressbar - text progressbar library for Python
  • python-qtext - Qt extensions for PyQt
  • python-qtext-dbg - Qt debug extensions for PyQt
  • python-simpleparse-mxtexttools - A simple parser generator for Python - architecture dependent files
  • python-tempita - very small text templating language
  • python-textile - Python parser for the Textile markup
  • python-whoosh - pure-Python full-text indexing, search, and spell checking library
  • python-wit - wikitext translation library
  • python-zope.index - Indices for using with catalog like text, field, etc.
  • python-othman - library providing access to Quranic text with a fast search index

FTP

  • python-obexftp - Python binding to the object exchange file transfer library
  • python-tftpy - A Pure-Python library for TFTP

SSH

  • python-paramiko - Make ssh v2 connections with Python
  • python-twisted-conch - The Twisted SSH Implementation
  • python-libssh2 - Python binding for libssh2 library

HTML5

  • python-html5lib - HTML parser/tokenizer based on the WHATWG HTML5 specification

Jabber

  • python-jabber - Python module for the Jabber instant messaging platform
  • python-xmpp - Python library for communication with XMPP (Jabber) servers
  • python-jabberbot - easily write simple Jabber bots
  • python-pyxmpp - XMPP and Jabber implementation for Python

OpenCV

  • python-opencv - Python bindings for the computer vision library

OpenAL

  • python-openal - port for Python of the OpenAL library

Graphs

  • python-objgraph - Ad-hoc tools for drawing Python object reference graphs with graphviz
  • python-pydot - Python interface to Graphviz's dot
  • python-pygraphviz - Python interface to the Graphviz graph layout and visualization package
  • python-yapgvb - Python bindings for Graphviz, using Boost.Python

Mobile

  • python-gammu - Python module to communicate with mobile phones
  • python-imobiledevice - Library for communicating with iPhone and iPod Touch devices
  • python-rapi2 - Make RAPI calls to a Windows Mobile device, Python bindings
  • python-rra - Library for syncing with Windows Mobile devices (Python bindings)

IRC

  • python-irclib - IRC client library for Python

InfraRed Devices

  • python-pylirc - Python bindings for Linux Infra-red Remote Control (LIRC) support

Scientific

  • python-pybiggles - Scientific plotting package for Python
  • python-scientific - Python modules useful for scientific computing
  • python-scipy - scientific tools for Python
  • python-scitools - Python library for scientific computing
  • python-sidl - Scientific Interface Definition Language (SIDL) Python runtime
  • python-viper - minimalistic scientific plotter and run-time visualization module
  • python-visual - VPython 3D scientific visualization library

SciLab

  • python-sciscipy - A Python binding of Scilab

More....

More....


PythonTimer Class example

PythonTimer Class example

>>> import PythonTimer
>>> t = PythonTimer.TickTockTimer()
>>> t.StartTimer()
>>> t.GetTime()
3.9744668006896973

>>> t.GetTime()
15.794264793395996

>>> t.Pause()
>>> t.GetTime()
16.001962900161743
>>> t.GetTime()
16.001962900161743

>>> t.UnPause()
>>> t.GetTime()
18.171801805496216
>>> t.GetTime()
19.801760911941528

More....