How can I convert a python urandom to a string?

前端 未结 4 620
无人共我
无人共我 2020-12-13 02:48

If I call os.urandom(64), I am given 64 random bytes. With reference to Convert bytes to a Python string I tried

a = os.urandom(64)
a.decode()
a.decode(\"utf         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 03:24

    this easy way:

    a = str(os.urandom(64))
    print(F"the: {a}")
    print(type(a))
    

提交回复
热议问题