我用的是mac的spyder 哪位兄台能告诉我一下spyder里面从哪儿能传入参数 不然老显示着sys.argv[1] list index out of range
2018-05-13
import pymysql
conn = pymysql.connect(host="localhost", port=3306, user="root",
passwd="123456", db="wallstreet",charset="utf8")
cur = conn.cursor()
print(cur)
print(conn)
cur.close()
conn.close()
conn = pymysql.connect(host="localhost", port=3306, user="root",
passwd="123456", db="wallstreet",charset="utf8")
cur = conn.cursor()
print(cur)
print(conn)
cur.close()
conn.close()
2018-04-06
mysql-python只支持Python2,要过时了,建议童孩通读API文档,还有直接使用pymysql,点个连接http://www.runoob.com/python3/python3-mysql.html 讲的也挺详细的
2018-04-05
import pymysql
conn = pymysql.Connect(
host = '127.0.0.1',port = 3306,user = 'root', passwd = 'root', db = 'demo',charset = 'utf8')
cur =conn.cursor()
## connection 对象使用的方法
# cursor() 使用该连接创建 并返回游标 # commit() rollback() close()
print(conn)
print(cur)
cur.close()
conn.close()
conn = pymysql.Connect(
host = '127.0.0.1',port = 3306,user = 'root', passwd = 'root', db = 'demo',charset = 'utf8')
cur =conn.cursor()
## connection 对象使用的方法
# cursor() 使用该连接创建 并返回游标 # commit() rollback() close()
print(conn)
print(cur)
cur.close()
conn.close()
2018-03-27