I was wondering if there was any key mapping in Vim to allow me to indent certain lines of code (whether those
The hash of infinity in Python has digits matching pi: >>> inf = float('inf') >>>
Python's math module contain handy functions like floor & ceil. These functions take a floating point
Is there a built-in or standard library method in Python to calculate the arithmetic mean (one type of average
I'm trying to convert one range of numbers to another, maintaining ratio. Maths is not my strong point.
This is the best algorithm I could come up. def get_primes(n): numbers = set(range(n, 1, -1)) primes
Is there a benefit to using one over the other? In Python 2, they both seem to return the same results: >&
float('nan') results in Nan (not a number). But how do I check for it? Should be very easy, but I ca
I've installed a library using the command pip install git+git://github.com/mozilla/elasticutils.git whi
How do I connect to a MySQL database using a python program?
I'm trying to install version 1.2.2 of the MySQL_python adaptor, using a fresh virtualenv created with th
What is the best way to open a file as read/write if it exists, or if it does not, then create it and open it
I try to convert matlab code to numpy and figured out that numpy has a different result with the std function.
I would like to execute the equivalent of the following MATLAB code using NumPy: repmat([1; 1], [1 1 1]). How
What is the Python equivalent of Matlab's tic and toc functions?
What is the best way to represent and solve a maze given an image? Given an JPEG image (as seen above), wha