pymysql链接时,密码含有特殊符号。类如含有@之类的特殊符号,在链接数据库时,需要提前url转码,不然会报密码错误。
python3/2分别引⽤是同样的第三⽅库,但是引⽤⽅式不同
python2
from urllib import quote_plus as urlquote
password = urlquote('password')
db_data = t(host='127.0.0.1',user='root'.password = password,db = 'test',port=3306,charser='utf8')到了python3,quote_plus成了parse的函数
python3
from urllib import parse
password = parse.unquote_plus('password')
db_data = t(host='127.0.0.1',user='root'.password = password,db = 'test',port=3306,chmysql下载链接
arser='utf8')

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。