python2 str object has no attribute decode
|
<div class="cnblogs_code"> .decode() 上述代码,报错: 'str' object has no attribute 'decode' 查找原因: https://stackoverflow.com/questions/29030725/str-object-has-no-attribute-decode You cannot decode string objects; they arealreadydecoded. You'll have to use a different method. You can use thecodecs.decode()functionto apply >>>> This applies aBinary transformcodec; it is the equivalent of using thebase64.b16decode()function,with the input string converted to uppercase: >>>> You can also use thebinascii.unhexlify()functionto 'decode' a sequence of hex digits to bytes: >>>> Either way,you'll get a 使用第二种方式解决了: >>> >>> base64.b16decode()(编辑:日照站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Python read打印与print区别
- python – 如何在熊猫中分组数据框并保留列
- java代码实现python2中aes加密经历
- 有没有办法从当前正在执行的python程序逐行输出管道?
- Python 拓展之详解深拷贝和浅拷贝!
- python – 请求 – 总是调用raise_for_status
- python – 运行迁移时出错:sqlalchemy.exc.CompileError:
- python – NLTK:如何遍历名词短语以返回字符串列表?
- python – Pandas:更改具有多级列的数据框中的特定列名称
- python – Django REST Framework中的camelCase POST数据
