美文网首页
python requests 测试存入(mysql)特殊字符(

python requests 测试存入(mysql)特殊字符(

作者: 戒灵 | 来源:发表于2018-10-22 17:44 被阅读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()

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

    相关文章

      网友评论

          本文标题:python requests 测试存入(mysql)特殊字符(

          本文链接:https://www.haomeiwen.com/subject/zungzftx.html