Skip to content

Instantly share code, notes, and snippets.

@ameliaikeda
Created February 22, 2013 12:33
Show Gist options
  • Save ameliaikeda/5013118 to your computer and use it in GitHub Desktop.
Save ameliaikeda/5013118 to your computer and use it in GitHub Desktop.
with MySQLCursor() as cur: # MySQLCursor is an auth wrapper around MySQLdb.cursor
with open('all', 'r') as f:
for line in f: # this file is terrifyingly huge
if line.startswith "#" or not line: # comment, wordlist boundary
continue
cur.execute("INSERT IGNORE INTO wordlist (word) VALUES (%s)", (line,))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment