iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🔒

Password Generation in Python

に公開
>>> import secrets
>>> secrets.token_urlsafe(8)
'-yXnN-Y-0YM'

This generates an N-byte token, but note that on average, 1 byte results in approximately 1.3 characters.

https://docs.python.org/ja/3/library/secrets.html

Discussion