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()

对应数据表设计字段(代码设置字符一定和表设置一致------对于特殊字符)

上一篇下一篇

猜你喜欢

热点阅读