我知道这在 python 2.6 中很容易实现。但是在 Python 2.5 中最简单的方法是什么?
x = "This is my string"
b = to_bytes(x) # I could do this easily in 2.7 using bin/ord 3+ could use b"my string"
print b
有什么建议么?我想把 x 变成
001000100100100/101001100100/101001001001,0001,0001,0001,0001,0001,0001,0001,000101001008100c_00100c1001,0001,0001,0001,0001,000100100100c1100c100100c1008100c100c100cup100100,0001,0001,0001,0001,0001,0001,0001,00010100100100c100c_1100100c1008100800cie100100c100c101,0001,0001,0001,0001,0001,0001,0001008100100c100100c>