kov*_*vac 2 python python-3.x chardet
import chardet
a='haha'
print(chardet.detect(a))
Run Code Online (Sandbox Code Playgroud)
类型错误:字节或字节数组类型的预期对象,得到:< class 'str'>
我只是输入教程中的代码。我真的无法弄清楚发生了什么错误。
要将字符串转换为字节...
改变:
a = 'haha'
Run Code Online (Sandbox Code Playgroud)
到:
a = b'haha'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5398 次 |
| 最近记录: |