import MySQLdb
from time import ctime
conn = MySQLdb.connect(host="localhost",user="root",passwd="",db="python")
cursor = conn.cursor()
sql = """INSERT INTO python.py_user_test
(username,
PASSWORD,
fstcreate)
SELECT
username,
PASSWORD,
fstcreate
FROM python.py_user
"""
try:
res = cursor.execute(sql)
print "success"
conn.commit()
except:
print "error"
conn.rollback()
conn.close()
关于python使用MySQLdb新增操作
最新推荐文章于 2024-11-13 07:00:00 发布