Manso Trick: Easy way to generate random hex string in Python

Generate a random string in hexadecimal is one of those things that you always have to do, from time to time.
As far as I know, the easiest way to do this in python is to import uuid module and run the following code:
uuid.uuid4().hex

With the call above we have 32 hexadecimal characters string (16 random bytes).

Do you know any other approach?

Trackback URL

,

Comments are closed.