Python On Regexp extraction in Python

by rullon.myopenid.com, March 17, 2010 19:12

no, its custom template fil...

Avatar Talk
1
perl -pi -e 's|<p><a.*||s'

Python On Regexp extraction in Python

by nicerobot, March 17, 2010 17:28

If that's the entire file, ...

7f69b0a9f0a030c37dca69736abb9f39 Talk
1
2
3
4
we have: 
--------

...

Python On Regexp extraction in Python

by rullon.myopenid.com, March 17, 2010 13:33

2nicerobot, thx for reply!
...

Avatar Talk
1
2
3
4
import re

def process_html(str):
...

Python On Regexp extraction in Python

by nicerobot, March 17, 2010 12:46

1. Regular Expressions Are ...

7f69b0a9f0a030c37dca69736abb9f39 Talk
1
2
import itertools
itertools.permutations([1,2,3],3)

Python On Computing permutations with...

by Gabriele, March 15, 2010 23:03
Avatar Talk
1
(lambda n:(lambda i=[n]:reduce(lambda a,x:(x!=1 and i.append(x%2 and x*3+1 or x/2)) or a+[x],i,[]))())(22)

Python On algoritmo collatz

by Anony, March 08, 2010 22:56

Not in any way better than ...

Avatar Talk
1
2
3
4
from bisect import bisect

def pos(ls, x):
...

Python On Return the indexes of speci...

by onk, March 07, 2010 21:07

@bob's bisect.

3ac88630891949b4e0fa568f413d8cdb Talk
1
2
3
4
def space_out_camel_case(s):
    """Adds spaces to a camel case string.  Failure to space out string returns the original string.
    >>> space_out_camel_case('DMLSServicesOtherBSTextLLC')
...

Python On CamelCase to Camel Case (Py...

by onk, March 07, 2010 19:38

Positional regex.

931ae7bf5fe3d90dc7016c7e8058e734 Talk
1
2
3
4
def permiter(ni):
    if not ni:
        yield []
...

Python On Permutation of values

by Hugh Brown, March 05, 2010 22:38

Simple code using generator...

Bbcac97b68f9e9cabd25a3f0f0bdbe49 Talk
1
2
3
4
from django.db import models

# Create your models here.
...

Python On Create a Dict from a Model

by Sam Thomson, March 02, 2010 18:48

This uses list comprehensio...

1c014f0c48fc85edb8e8e28a1e8bb8ae Talk
1
Train Danger,capable used express turn pleasure official brief case neck when map end ready follow population academic intention policy drive vision edge rely photograph separate demand favour mechanism relation arise property most employ partner scientific lot signal domestic commission grant better provision forget appeal investment citizen somewhat sound range all feeling complex extremely population factory improvement play suggest feel background action understand until unfortunately corporate begin literature present quite example forget inside stuff achieve credit whom face anybody pleasure them upper goal discuss doctor fresh week environmental relatively 

Python On Reformat svn log output

by gunstiges hotel, February 25, 2010 12:16

Train Danger,capable used e...

17a547c8fa25d4d610c9c881e1a63b15 Talk
1
2
3
4
from django.db import models

# Create your models here.
...

Python On Create a Dict from a Model

by Matthew Schinckel, February 22, 2010 11:09

This should really be in a ...

833bfbcc9940cfcf0af6def751c23b05 Talk

Python On Return the indexes of speci...

by bob, February 14, 2010 18:58

Since the array is sorted, ...

Avatar Talk
1
2
	def __str__(self):
		return '[{0}]'.format(', '.join( [str(node) for node in self] ))

Python On Linked List

by Sean B., February 13, 2010 00:30

Modified __str__ implementa...

98f46668d0ec395baf6f848bf8509cec Talk

Python On Return the indexes of speci...

by Ants, January 31, 2010 07:01

It looks a bit frightening ...

F9a9ba6663645458aa8630157ed5e71e Talk
1
2
3
4
def get_pos(rel_dates):
	"""returns the positions of the dates closest to 25%, 50%, and 75%"""
	dates25 = [abs(date-25) for date in rel_dates]
...

Python On Return the indexes of speci...

by Kevin Baribeau, January 30, 2010 20:39

You may or may not like thi...

F571a96564c78a854662a00358c33160 Talk
1
2
3
4
# This function returns a list of the primes
# between 2 and n inclusively. It is given
# an integer n and prints the list.
...

Python On Sieve of Eratosthenes

by Nick, January 28, 2010 19:33

This is what I came up with...

Avatar Talk
1
2
3
def scale_dates(dates):
    d = float(dates[-1] - dates[0])
    return [(date-dates[0])/d for date in dates]

Python On Scale data points with the ...

by x-way, January 23, 2010 22:19
5023923d5d5ce3d95d0f73b5dd8afc88 Talk
1
2
3
def scale_dates(dates):
    d = float(dates[-1] - dates[0])
    return [(date-dates[0])/d for date in dates]

Python On Scale data points with the ...

by x-way, January 23, 2010 22:18
5023923d5d5ce3d95d0f73b5dd8afc88 Talk
1
i wanted the code to count the no of occurences of each word in a text using java script .!! pls anyone help !!!

Python On Count word occurrences in a...

by Suganya, January 19, 2010 09:23
Eead9f6e9e61907ec68459cbed598454 Talk
1
2
3
4
def gen_primes():
    """ Generate an infinite sequence of prime numbers.
    """
...

Python On Sieve of Eratosthenes

by Eli, December 26, 2009 06:33
Fc761ccaf6c0d7d977e2959f9bfebd06 Talk
1
2
3
4
def gen_primes():
    """ Generate an infinite sequence of prime numbers.
    """
...

Python On Sieve of Eratosthenes

by Eli, December 26, 2009 06:24
Fc761ccaf6c0d7d977e2959f9bfebd06 Talk

Python On Sieve of Eratosthenes

by bob, December 18, 2009 01:23

What about multiples of thi...

Avatar Talk

Python On LUA 4.0 Date check

by Ants, December 07, 2009 20:56

I'm not fluent with LUA, bu...

F9a9ba6663645458aa8630157ed5e71e Talk
1
2
        ub =    float(((B.x-A.x)*(A.y-C.y))-((B.y-A.y)*(A.x-C.y)))/ \
                float(((D.y-C.y)*(B.x-A.x))-((D.x-C.x)*(B.y-A.y)))

Python On Line-line intersection test

by Aneel, December 02, 2009 21:40

ub is calculated, but never...

Avatar Talk