randomly.password

randomly.password

randomly.password.generate_password(chars: int, punctuation: bool, invalid_chars: Optional[Iterable] = None) str[source]

Make a random string of any length.

Parameters
  • chars (int) – Number of characters desired in the output.

  • punctuation (bool) – Whether or not to include punctuation characters.

  • invalid_chars (Optional[Iterable], optional) – An iterable of characters that should not appear in the result. By default None, in which case no extra characters are excluded.

Returns

A random string that can be used as a password.

Return type

str