import thread, time, urllib2, threading
# Try changing the 3 in the following line....
sa = threading.Semaphore(5)
def myPrint(x):
    sa.acquire()
    print 'This is thread number ',x
    sa.release()
for y in range(10):
    thread.start_new_thread(myPrint, (y,))
