python --------- directly to do gymnastics database

db = pymysql.connect(host='172.16.0.162', port=3306, user='root', passwd='123456', db='mark', charset='utf8')
cursor = db.cursor()
sql = 'select id from m_news_tb where news_title="'+title+'"'
cursor.execute(sql)
db.commit()

 

Guess you like

Origin www.cnblogs.com/11wangxin7/p/11613297.html