This function takes a range in form of "a-b" and generate a list of numbers between a and b inclusive.
Also accepts comma separated ranges like "a-b,c-d,f" will build a list which will include numbers from a to b, a to d and f
Here is a quick and dirty way to sort a list of dictionary based on a key value.
Generates a list of links used in a post. This can be used to create a list of references like those in scientific publications. Add [lor] at the end of your post (or wherever you want the list of references) and add a title attribute to all links...
One of the most frequently asked questions is how to efficiently get a list of Python dictionaries from a database query rather than the difficult-to-use list of tuples.
Group a list of items according to the starting character(s) of items.
This is based on Raymond Hettinger's groupby class:
Sometimes you get a list of lists and want to swap rows and columns, i.e. transpose the list. Yet, what if the rows have different lengths? Here is some advice you might find useful in such situations.
I often return result sets from a database call using a list of dictionary objects. When transmitting the pickled list object over the wire, the size of the pickle greatly effects the speed of the transmission.
I wrote this small class...
This module takes a list of equal length lists and converts it into XML.
If the first sublist is a list of headings, these are used to form the element names of the rest of the data, or these can be defined in the function call. Root...
List of Posts from each Category plugin for WordPress
This plugin displays a list of the posts from each category of your WordPress installation. It can be added to a post or page, or used directly in a template file. In the...
A simple widget that will display a list of your sticky posts.
1. Download and unzip the most recent version of this plugin
2. Upload the sticky-posts-widget folder to...
This is an evolutionary algorithm that returns a random list of prime numbers. This code is highly inefficient for a reason. This algorithm is more of a proof of concept that if a prime was a heritable trait, it would not be a desired one.
Here is a handy script that uses the simplex algorithm to compute an optimum list of refunds (for example, after a trip with shared expenses with friends).
It minimizes the number of transactions (refunds) required to reach the balance.
Pass the name of the directory which contains the dicom files to the dicomreaddir function to get an ordered list of dicom files.
Please see the dicomreaddir_demo for a sample usage.
In the main code: dicomreaddir, one can...
This implementation is based on the 1968 Murty algorithm for finding a ranked list of the best assignments for an arbitrary cost matrix.
This algorithm uses a user-supplied assignment algorithm, such as the Munkres (Hungarian) algorithm...
Given starting and ending points returns list of coordinates as per Bresenham's line algorithm. I wrote this a long time ago under Matlab 4.x I think. It works under Matlab 5.3 and 6.1. I have not reviewed the code since I wrote it.
This module, show a list of contacts with photo, name, position and contact link. Is great for show a people list with his photo in a module. You can use this module for show a business or organization employers list with his position. This module...
Given an arbitrary list (of length >= 1) of positive integers, return the greatest common divisor (gcd) of the list.
Walk through a list of directories and rename the files within those directories based on the directory name and an index value. Useful for managing photos when downloaded from a camera into directories based on the shooting date.
This function parses a full file specification into tuple of:
a) list of drive and folders
b) file name
c) (last) file extension (including dot)
User Defined Table has a new name! Form and List
Core Module "User Defined Table" allows the creation of a list of records with fields, that can be specified by the page admin interactively. Each field gets a dedicated type...