There are many places in the program that require random characters, such as random verification codes for login sites, and random strings can easily be generated in Python via the random module.
Example: Lotto, company annual draw
>>> Import random>>> random.randint (1,100) #1 100 takes a random number in the middle, including 10032>>> Random.randint (1,100) 59>>> random.randint (1,100) 32>>>random.randrange (1-100) #1 100 in the middle takes a random number, does not contain 10022 >>>random.choice (' da124#! ') #从字符串里返回随机的东西, the spell random verification code may be used to ' 4 ' >>>random.sample (' da124#! ', 3) #返回3个随机值 [' # ', ' 4 ', ' 1 ']>>> import string>>> string.digits ' 0123456789 ' >>> string.ascii_letters ' Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ' >>> string.hexdigits ' 0123456789abcdefABCDEF '
python-Module-random