此错误就是因为需要string类型的数据,但是你的数据(x)是byte型。 解决方法: x.decode() 转载于:https://www.cnblogs.com/fh-fendou/p/9522458.html