Thursday, February 16, 2012

Friday, February 10, 2012

Python Tip: Format number with comma

Here is a good little tip for the client that wants to see those commas in there numbers: (for python 2.6)

>>> import locale
>>> locale.setlocale(locale.LC_ALL,"")
'English_United States.1252'
>>> y = locale.format('%d',1239811,True)
>>> print y
1,239,811


Enjoy

Wednesday, February 1, 2012

Killing Python.exe Processes Fast and Easy

When performing multiprocessing or subprocessing, sometimes you need to kill that script, and fast.  You can use task manager to do this, but that's too many clicks.

There is a great window's program called taskkill.exe.  To do this process, you need to create a link.  Once you have the link, enter in the following command: 'C:\Windows\System32\taskkill.exe /F /IM python.exe /T'

All processes will end quickly.