
数据库
言希0127
这个作者很懒,什么都没留下…
展开
-
mysql python
#coding=utf-8import MySQLdbcon = MySQLdb.connect(host='127.0.0.1',user='root',passwd='2',db='nan',port=3306)cur = con.cursor()cur.execute('CREATE TABLE IF NOT EXISTS tableone (id int not null a...原创 2018-09-15 21:51:18 · 183 阅读 · 0 评论 -
python 数据库 mongodb
#coding=utf-8import pymongo#print pymongo.__version__client = pymongo.MongoClient(host='127.0.0.1',port=27017)db = client.testcollection = db.studentsstudent = { 'id':'20170905', 'nam...原创 2018-09-16 10:16:41 · 248 阅读 · 0 评论 -
数据库 (一) sqlite3
#coding=utf-8import sqlite3import sysreload(sys)sys.setdefaultencoding('utf-8')con = sqlite3.connect('/home/flyvideo/sqlite3database.db')con.text_factory = str # 插入的字符串中含有中文字符,得加这一行con.execut...原创 2018-09-15 09:45:51 · 208 阅读 · 0 评论