标签: python-2.7 python-3.x
> python2 -c "print(ord(b'a'[0]))" 97 > python3 -c "print(ord(b'a'[0]))" Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: ord() expected string of length 1, but int found
如何以适用于Python 2和Python 3的方式编写此代码?