Python secrets.token_hex() Function
The secrets.token_hex() function generates a secure random text string in hexadecimal.
This is suitable for password reset tokens, API keys, and other security-sensitive applications.
Syntax
secrets.token_hex(nbytes=None)
Return Value
A random text string in hexadecimal.
Example
Output
Click Run to execute your code