【发布时间】:2012-05-14 00:34:56
【问题描述】:
Python 3 文档在其codecs page 中列出了 rot13。
我尝试使用 rot13 编码对字符串进行编码:
import codecs
s = "hello"
os = codecs.encode( s, "rot13" )
print(os)
这会产生unknown encoding: rot13 错误。有没有不同的方法来使用内置的 rot13 编码?如果在 Python 3 中删除了这种编码(如 Google 搜索结果所示),为什么它仍然在 Python3 文档中列出?
【问题讨论】:
-
您尝试了
s.encode("rot13")还是s.encode("rot_13")?我认为没有codecs.encode这样的东西,只有codecs.Codec().encode -
agf:codecs.Codec().encode()函数只接受字符串输入,没有参数传入编码类型。
-
你不应该影响
os。 ಠ_ಠ
标签: python python-3.x rot13