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.
Given an arbitrary list (of length >= 1) of positive integers, return the greatest common divisor (gcd) of the list.
Transcript merges functionality of legacy UNIX 'script' tool and shell command history to provide a convenient access to the list of executed commands along with its output. Includes also automatic user input highlight and copy to X11...
What if you had a list like this: [1, -10, [1,2,[3,4]], xrange(200)], and you just wanted to go through each element in order (wanted it to return a simple list of [1,-10,1,2,3,4,1,2,3,4...199])
I've seen a couple of attempts to flatten...
This recipe returns a list of size n such that the contents of the returned list are random 0s and 1s. It returns a random binary list of size n.
This module/function lets you find a 2 dimensional list of indices for elements you are looking for in a super list.
returns: [[0, 1, 2, 4], [3, 5], [6, 7]]
This is a little code for making a list that can have only items from a list of types
This script helps you to organize a list of values. You can place them in any order.
You are allowed to add and delete items from the list.
This script shows you a list of options based on what you type into a text input.
When you are finished, click 'Show List' to see the entries.