【发布时间】:2021-01-23 00:34:53
【问题描述】:
我有以下代码
import os
unk2 = os.urandom(10)
totlen = len("lol1") + len("lol2")
ownershipsectionwithsig = "random1" + "random2"
ticket = list(unk2) + list(ownershipsectionwithsig)
ticket = "".join(map(str, ticket))
print(ticket)
代码用于我正在测试的与 RNG 相关的东西。
在 python 2 中,它打印以下 ?zoռv3L??random1random2
但是在 python 3 中它会打印 245148103178837822864207104random1random2
由于某种原因,python 3 不像 python 2 那样显示原始字节输出,而是将其转换为某种东西。我将如何更改我的代码,以便 python 3 以 python 2 的方式输出代码?
提前致谢。
【问题讨论】:
标签: python python-3.x python-2.7 types