Simple substring counting script in Python
Approximately a month ago I endeavoured to use Python as my main shell-scripting language. At that moment, I was already aware of multiple benefits you get when you use Python for...
View ArticleGUIs for R
I’ve tried [briefly] Cantor (which also supports Octave and KAlgebra as backends), rkward, deducer/JGR, R Commander, and RStudio.My personal choice was RStudio: it is good-looking, intuitive,...
View ArticleGraphs in Python
Sooner or later, everyone has to deal with graphs. Some people have to do programming with graphs, and a subset of those – do that in Python.NetworkX is a pure Python implementation, where anything can...
View ArticleBeanstalkd and related tools for easy parallelizing and backgrounding
beanstalkd: a simple, fast work queue. Jack and the Beanstalkd: a web-app for basic work queue administration. beanstalkc: a simple beanstalkd client library for Python. queueit: a CLI interface tool...
View ArticlePython performance: set vs list
Sometimes there is a need to be sure that no identifier is processed twice – for example, when parsing a file into a database, with file potentially containing duplicate records. An obvious solution is...
View ArticleUsing Python in a Java project
If you are a Python zealot, and Java doesn’t feel right, but the project you are working on is a Java project – tryJython – Python for the Java platform, compile your python scripts into Java...
View ArticleIntroduction to Python for bioinformatics
This overview presentation is two years old, but still a highly valuable resource: modules and tools mentioned are alive and useful. I think this is the second presentation by Giovanni I’m embedding...
View ArticleHow to easily install any PyPi/easy_install python module on Debian
Imagine you need to install pycassa (which uses easy_install). Here are the 2 (at maximum) very simple steps to have it properly debianized and installed on your Debian/Ubuntu:if you don’t have the...
View ArticleGood online Python book with code examples
Building Skills in Python: A Programmer’s Introduction to Python by Steven F. Lott (© 2002, 2005, 2007, 2008 Steven F. Lott).
View ArticlePython: passing by value vs passing by reference
Note: this a collection of scraps, describing how values (de)referencing works in Python, and describing when your variable is either a value or a reference. Primary source of knowledge for this post...
View ArticleUseful Python looping techniques
These are all excerpts from the Python documentation.To synchronously and simultaneously loop over two sequences:[python] questions = ['name', 'quest', 'favourite colour'] answers = ['Lancelot', 'the...
View ArticleHow to sort Python dict (dictionary)
Sample script (copypasted from Well House Consultants training course): click the PLAIN TEXT header for copy-pasteable version [python] #!/usr/local/bin/pythonauthor = {“php”:”Rasmus Lerdorf”,\...
View ArticleMySQL – Python: good MySQLdb tutorial (examples)
Andy Dustman (used to blog at dustman.net) gave a presentation on Python and MySQL at the MySQL Users Conference 2005, Santa Clara, CA. The presentation is an excellent collection of examples for those...
View ArticlePython: iterate (and read) all files in a directory (folder)
To iterate through all the files within the specified directory (folder), with ability to use wildcards (*, ?, and [ ]-style ranges), use the following code snippet: [python] import os import globpath...
View ArticleWhy Zope 3 is just great
Recently I learned about Zope, which is an “open source web application server”, primarily written in Python.Then Django and Turbogears were seen as web-development frameworks akin to Zope. Search...
View Article