[ create a new paste ] login | about

Link: http://codepad.org/XMw9QOSw    [ raw code | fork ]

Python, pasted on Feb 20:
#UCD.py

import sqlite3
import os

sql_get_script="""
SELECT sc
FROM repertoire
WHERE cp=?
""";

sql_get_joining="""
SELECT jt
FROM repertoire
WHERE cp=?
""";

def script(character):
    db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'ucd.db'));
    try:
        c = db.execute(sql_get_script,(ord(character),));
        return c.fetchone()[0].lower();
    finally:
        db.close();

def joining(character):
    db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'ucd.db'));
    try:
        c = db.execute(sql_get_joining,(ord(character),));
        return c.fetchone()[0];
    finally:
        db.close();


Create a new paste based on this one


Comments: