来看看实现,首先我们要下载提供DB API2.0接口的模块psycopg2,路径:http://initd.org/psycopg/download/,此模块API手册地址为:http://initd.org/psycopg/docs/index.html
一、实现: