This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this simple example recurses over a mixed data structure of tuples, lists, and dicts, and returns a copy. | |
num_recursions = 0 | |
def r(current): | |
global num_recursions | |
num_recursions += 1 | |
if isinstance(current, list): | |
return [r(i) for i in current] | |
elif isinstance(current, dict): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import bs4 | |
import json | |
import urllib2 | |
import html2text | |
import nltk | |
import collections | |
# to do, lets turn this into a full class (that can be imported) | |
# and use argparse (which invokes serializing it to a file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import operator | |
import re | |
import numpy as np | |
class Perudo(): | |
def __init__(self): | |
print "-- New Game --\nNumber of players?" | |
num_players = int(self.user_input()) |
NewerOlder