python Programming Glossary: adapted
How do I capture SIGINT in Python? http://stackoverflow.com/questions/1112343/how-do-i-capture-sigint-in-python signal_handler print 'Press Ctrl C' signal.pause Code adapted from here . More documentation on signal can be found here ...
Embedding IPython Qt console in a PyQt application http://stackoverflow.com/questions/11513132/embedding-ipython-qt-console-in-a-pyqt-application application I am working on. The code provided below and adapted from http stackoverflow.com a 9796491 1332492 Accomplishes this..
How to solve the “Mastermind” guessing game? http://stackoverflow.com/questions/1185634/how-to-solve-the-mastermind-guessing-game e.g. what is its worst case General can be easily adapted to other types of puzzle than Mastermind I'm happy with an algorithm..
python captcha decoder library http://stackoverflow.com/questions/13664161/python-captcha-decoder-library fixed size and font then the following code can be easily adapted. What the code does is a load the patterns I considered they..
How do I create an OpenCV image from a PIL image? http://stackoverflow.com/questions/1650568/how-do-i-create-an-opencv-image-from-a-pil-image cvLoadImage call since that takes a filename. This recipe adapted from http opencv.willowgarage.com wiki PythonInterface does..
SendKeys for Python 3.1 on Windows http://stackoverflow.com/questions/1823762/sendkeys-for-python-3-1-on-windows for python 3 from jh45dev@gmail.com code from Daniel F is adapted here. The original is at http mail.python.org pipermail python..
How to efficiently parse emails without touching attachments using Python http://stackoverflow.com/questions/2301213/how-to-efficiently-parse-emails-without-touching-attachments-using-python at this recipe http code.activestate.com recipes 498189 I adapted it slightly to print the From Subject Date name of attachments..
Search for string allowing for one mismatch in any location of the string http://stackoverflow.com/questions/2420412/search-for-string-allowing-for-one-mismatch-in-any-location-of-the-string Raffinot google Navarro Raffinot nrgrep and this could be adapted to Hamming searches. Note that bit parallel methods have limitations..
Numpy ?˜smart??symmetric matrix http://stackoverflow.com/questions/2572916/numpy-smart-symmetric-matrix of writing def i j so the code has to be slightly adapted before running with Python 3 def __setitem__ self indexes value..
Check for presence of a sublist in Python http://stackoverflow.com/questions/3313590/check-for-presence-of-a-sublist-in-python you can look at the Boyer Moore string searching algorithm adapted to work on lists. A naive search has O n m worst case but can..
How to correct bugs in this Damerau-Levenshtein implementation? http://stackoverflow.com/questions/3431933/how-to-correct-bugs-in-this-damerau-levenshtein-implementation to validate results returned from the above method. Code adapted from http mwh.geek.nz 2009 04 26 python damerau levenshtein..
How do I download a zip file in python using urllib2? http://stackoverflow.com/questions/4028697/how-do-i-download-a-zip-file-in-python-using-urllib2 str index dlfile file_name wb base_url This script was adapted from here python urllib2 share improve this question Here's..
Is it possible to use Nose to run one test multiple times, concurrently? http://stackoverflow.com/questions/4088354/is-it-possible-to-use-nose-to-run-one-test-multiple-times-concurrently someplace else and can benefit from parallelization. I've adapted the plugin to run a single test in parallel as you want. Download..
Is there a Google Insights API? http://stackoverflow.com/questions/4440139/is-there-a-google-insights-api year . Here is some python code for doing this slightly adapted from code by odewahn1 at O'reilly Answers and working on Python..
Finding number of colored shapes from picture using Python http://stackoverflow.com/questions/5298884/finding-number-of-colored-shapes-from-picture-using-python share improve this question Count nuclei The code adapted from Python Image Tutorial . Input image with nuclei from the..
Generating natural schedule for a sports league http://stackoverflow.com/questions/5913616/generating-natural-schedule-for-a-sports-league improve this question I found a method here which I adapted slightly to this def round_robin units sets None Generates a..
IronPython: EXE compiled using pyc.py cannot import module “os” http://stackoverflow.com/questions/6195781/ironpython-exe-compiled-using-pyc-py-cannot-import-module-os 'System' clr.AddReference 'System.Data' # # adapted from os path walk example 3.py import os glob import fnmatch..
Celery periodic_task running multiple times in parallel http://stackoverflow.com/questions/7719203/celery-periodic-task-running-multiple-times-in-parallel it simply prints Pre and Post and sleep in between. It is adapted from this StackOverflow question and this linked website from..
Constructing Django filter queries dynamically with args and kwargs http://stackoverflow.com/questions/8510057/constructing-django-filter-queries-dynamically-with-args-and-kwargs
django excel xlwt http://stackoverflow.com/questions/883313/django-excel-xlwt PDFs with ReportLab to see a similar situation. edit adapted from ShawnMilo's comment def xls_to_response xls fname response..
Embedding IPython Qt console in a PyQt application http://stackoverflow.com/questions/11513132/embedding-ipython-qt-console-in-a-pyqt-application to achieve the equivalent functionality for IPython v0.13 Adapted from http stackoverflow.com a 9796491 1332492 import os import..
How to create a menu and submenus in Python curses? http://stackoverflow.com/questions/14200721/how-to-create-a-menu-and-submenus-in-python-curses Python 2.7 this is my current code # usr bin python # # Adapted from # http blog.skeltonnetworks.com 2010 03 python curses custom..
Find out into how many values a return value will be unpacked http://stackoverflow.com/questions/16481156/find-out-into-how-many-values-a-return-value-will-be-unpacked return range n python share improve this question Adapted from http code.activestate.com recipes 284742 finding out the..
How to create a zip archive of a directory in python? http://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory-in-python 'Python.zip' 'w' zipdir 'tmp ' zipf zipf.close Adapted from http www.devshed.com c a Python Python UnZipped share..
How do I zip the contents of a folder using python (version 2.5)? http://stackoverflow.com/questions/296499/how-do-i-zip-the-contents-of-a-folder-using-python-version-2-5 python file zip python 2.5 share improve this question Adapted version of the script is # usr bin env python from __future__..
Quick and easy: trayicon with python? http://stackoverflow.com/questions/6389580/quick-and-easy-trayicon-with-python improve this question Here ya go wxPython is the bomb. Adapted from the source of my Feed Notifier application. import wx TRAY_TOOLTIP..
Python multiprocessing: How do I share a dict among multiple processes? http://stackoverflow.com/questions/6832554/python-multiprocessing-how-do-i-share-a-dict-among-multiple-processes code but a general answer involves using a Manager object. Adapted from the docs from multiprocessing import Process Manager def..
Is there a way to list all the available drive letters in python? http://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python drives drives.split ' 000' 1 print drives Adapted from http www.faqts.com knowledge_base view.phtml aid 4670 ..
|