我试图使用 str.encode()
,但我得到
>>> "hello".encode(hex)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: must be string, not builtin_function_or_method
我已经尝试了很多变体,它们似乎都可以在 Python 2.5.2中工作,那么我需要做些什么才能让它们在 Python 3.1中工作呢?