python requests 测试存入(mysql)特殊字符(
2018-10-22 本文已影响0人
戒灵
import pymysql,requests
conn = pymysql.connect(host='localhost',user='root',
passwd='root',db='test01',port=3306,charset='utf8mb4')
cur = conn.cursor()
cur.execute('insert into shopee_test(name) values(%s)',(" Case Shell Protector Cover🎉INSTOCKS🎉Black Apple Macbook LaptopAir/Retina/Pro"))
print('success connect')
conn.commit()
sql ="select *from shopee_test"
cur.execute(sql)
for rowin cur.fetchall():
print(row[0])
cur.close()
conn.close()