Skip to content

Instantly share code, notes, and snippets.

View gamingrobot's full-sized avatar
🤖
Doing Stuff

Morgan Creekmore gamingrobot

🤖
Doing Stuff
View GitHub Profile
import sys
import HTMLParser
import re
import MySQLdb
htmlparser = HTMLParser.HTMLParser()
numwords = 2
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="wiki1")
cur = db.cursor()
import sys
import HTMLParser
import re
htmlparser = HTMLParser.HTMLParser()
numwords = 2
def main(filename):
with open(str(filename)) as infile:
@gamingrobot
gamingrobot / gist:4755675
Created February 11, 2013 16:52
Get calling class
def _getName(self):
retmod = "Module"
frame, module, line, function, context, index = inspect.stack()[2]
try:
self_argument = frame.f_code.co_varnames[0] # this should be self
instance = frame.f_locals[self_argument]
retmod = instance.__class__.__name__
except IndexError:
retmod = inspect.getmodulename(module)
return retmod