AttributeError: ‘str‘ object has no attribute ‘decode‘

AttributeError: ‘str’ object has no attribute ‘decode’

在这里插入图片描述

解决方法

直接去掉decode(‘utf8’)

tips:str通过encode()方法可以编码为指定的bytes。反过来,当从网络或磁盘上读取了字节流,那么读到的数据就是bytes。要把bytes变为str,就需要用decode()方法。反之,则使用encode()方法即可!

猜你喜欢

转载自blog.csdn.net/weixin_39536859/article/details/107149044