:PROPERTIES: :ID: 9bdede16-5137-4393-a027-a5afbffd1618 :mtime: 20220104163314 :ctime: 20220104162747 :END: #+title: Génération chaine de caractères aléatoires #+filetags: :Python: #+BEGIN_SRC python :results output import random import string # get random password pf length 8 with letters, digits, and symbols len_ = 20 characters = string.ascii_letters + string.digits + string.punctuation print(f"Random password is: \"{''.join(random.choice(characters) for i in range(len_))}\"") #+END_SRC #+RESULTS: : Random password is: "'f#babNz3u&P|ctLy7WZ"