1import sqlite3 2 3class Point: 4 def __init__(self, x, y): 5 self.x, self.y = x, y 6 7def adapt_point(point): 8 return "%f;%f" % (point.x, point.y) 9 10sqlite3.register_adapter(Point, adapt_point) 11 12con = sqlite3.connect(":memory:") 13cur = con.cursor() 14 15p = Point(4.0, -3.2) 16cur.execute("select ?", (p,)) 17print(cur.fetchone()[0]) 18 19con.close() 20