from itertools import product def breadth_first_product(*args): """Works like itertools.product but iterates "breadth first". ...
Python Breadth first cartesian pro...
by abrakadabra42.myopenid.com,
January 02, 2012 17:28,
17 refactorings, tagged with iterators, cartesian product
#imported modules import os import random ...
Python final course program
by ruok1212.myopenid.com,
December 14, 2011 17:35,
3 refactorings
I cant get my program to wo...
import array
byte_array = array.array('B', uploaded_file_instance.read(uploaded_file_instance.size))
...
Python Django UploadedFile instanc...
by slimkrazy.myopenid.com,
November 30, 2011 03:36,
1 refactoring, tagged with python, django, files, binary strings
A third party library requi...
def foo(mylist):
magic = 0
for i in range(len(mylist)-1):
...
Python Two loops on list
I want to apply some calcul...
select distinct(user_id) from facebook_post_comments where page_id =some_page_id and user_id in (select distinct(user_id) from facebook_post_comments where page_id = some_other_page_id)
Python MySQL O(n^2)
by https://www.google.com/accounts/o8/id?id=AItOawlXyCfS3cPSoWLo635rrzVPpmDr0-DUdus,
October 20, 2011 12:54,
2 refactorings, tagged with sql, mysql, short clean ruby
Hello! Trying to run this q...
# group by year,month of epoch integer and get count of groups # where status == A. Data is stored in postgres ...
Python SQLalchemy Cleanup?
by https://www.google.com/accounts/o8/id?id=AItOawkVnMGHZ8OQzIo-_s-pjTis-yeOsejMNsc,
October 14, 2011 12:36,
No refactoring, tagged with sqlalchemy
Yesterday I found myself wr...
import sys from random import randint for i in range(1, 7): ...
Python 6 bit password generator
by https://www.google.com/accounts/o8/id?id=AItOawl3BeAhTXKYDpKI7ld64fgVwaukoKGEuUo,
September 04, 2011 04:17,
5 refactorings, tagged with random, python
I needed 6 random(ish) bits...
import unittest def longest_repeating_subsequence(seq): ...
Python Longest Repeating Subsequence
Can you make it faster whil...
def changeWordSize ( words, inSize, outSize ):
"""
>>> list( changeWordSize( [255, 18], 8, 1 ) )
...
Python changeWordSize
by Leif Ryge,
July 18, 2011 18:31,
No refactoring, tagged with generator, generators, binary, bitwise, bitshift, ordinal, words
Generator which transforms ...
import csv, ConfigParser, datetime, time from lxml import etree ...
Python XML Schema parsing and XML ...
by https://www.google.com/accounts/o8/id?id=AItOawnskEpQmE0uSHiw6mtC_WFcUDNCuvejHdE,
July 21, 2011 10:08,
No refactoring, tagged with xml, parsing, xsd, lxml
I wrote a tool to parse som...
def to_bits(number): bit = 1 bits = [] ...
Python extract bits from number
extract the bits components...
#!/usr/bin/python """rss2email: get RSS feeds emailed to you http://rss2email.infogami.com ...
Python output to html attachment i...
by nath75.myopenid.com,
June 25, 2011 11:59,
No refactoring
I'm trying to mod rss2email...
# This file is part of python-magento-api # python-magento-api is free software: you can redistribute it and/or ...
Python Python Magento API
A Python-based API to the M...
storeList = dom.select("//table/tr/td[@width='642']/table/tr/td[@width='180']/text()").extract() #store names
addressHTML = dom.select("//table/tr/td[@width='642']/table/tr/td[@class='tableitem']").extract() #store addresses, contains HTML so we need to parse out the actual address
addressList = []
...
Python Merging two addresses into ...
by Hiawatha,
April 20, 2011 02:27,
5 refactorings
Hi, I'm brand new to Python...
#/usr/bin/env python __author__ = 'Luiz Augusto de M. Morais' ...
Python isprime
by https://profiles.google.com/luizaugustomm,
April 13, 2011 19:22,
3 refactorings, tagged with python, Prime, Prime Numbers
This code contains a functi...
def merge_words(words_1, words_2, words_3):
"""Take 2 to 3 lists of phrases and return 1 list of all combinations
of those lists"""
...
Python Find All Combinations of 2 ...
by https://www.google.com/accounts/o8/id?id=AItOawnF67iZ7jkF06oL0iuNySBalihADlPMJ-8,
March 15, 2011 01:15,
6 refactorings, tagged with lists, combinations
The code should accept thre...
#!/usr/bin/env python # -*- coding: utf-8 -*- ...
Python Python Koan Score Function
I am brushing up on my Pyth...
# Load the required modules import random import sys ...
Python Secure password generation ...
by deepspring,
January 02, 2011 11:11,
3 refactorings
I've been playing around wi...
import urllib import urllib2 import socket ...
Python Hacking on stashboard
by https://www.google.com/accounts/o8/id?id=AItOawm9KPn_KBr_DmJv8_XERiiYT9NeXM0p6q8,
January 14, 2011 22:22,
3 refactorings, tagged with google, appengine, stashboard
I'm a python noob. Tell me ...
def showruns(self, lst, n):
"""
assumes that lst is already sorted
...
Python Show a list of at least n c...
by alokt,
January 08, 2011 18:39,
2 refactorings
Python n00b here. It works ...
#imported modules import os import random ...
Python encryption/decryption program
by https://me.yahoo.com/a/UQ.IiSl4notHYWA4oeCbS43hXJ44tQ--,
December 08, 2010 19:04,
17 refactorings
Hello! Long time browser, f...
def zip_plus(source_list, additional_list):
"""
Like zip but does plus operation where zip makes a tuple
...
Python variations on zip
by https://www.google.com/accounts/o8/id?id=AItOawnsm--vLmQJ3pTQIjTkYd0hwwcCxZEprhY,
December 15, 2010 01:52,
1 refactoring, tagged with python, lists
2 functions i need to build...
docs = [[
re.sub(re.compile(r'\s+',re.M|re.S),' ',
re.sub(' ',' ',
...
Python 2-levels mapping and severa...
by https://www.google.com/accounts/o8/id?id=AItOawnIj5nQFWAcqcdfHgLfzs3Ngw8moQG-ggo,
November 04, 2010 17:33,
1 refactoring
I'm translating Ruby code i...
There must be an easier way...