1. Output all large (small) letters with one line, and numbers
1 Print([Chr (i) forIinchRange (65, 91)])#All uppercase Letters2 Print([Chr (i) forIinchRange (97, 123)])#All lowercase letters3 Print([Chr (i) forIinchRange (48, 58)])#All numbers4 5 ####################6['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']7['a','b','C','D','e','F','g','h','I','J','k','L','m','N','o','P','Q','R','s','T','u','v','W','x','y','Z']8['0','1','2','3','4','5','6','7','8','9']
1 ImportString#Import string This module2 Print(string.digits)#output A string containing a numeric 0~93 Print(string.ascii_letters)#A string containing all letters (uppercase or lowercase)4 Print(string.ascii_lowercase)#a string containing all lowercase letters5 Print(string.ascii_uppercase)#A string containing all uppercase letters6 7 8 ##############90123456789Ten abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz One abcdefghijklmnopqrstuvwxyz AAbcdefghijklmnopqrstuvwxyz
2. Generate Random Verification code
1 Import Random 2 def Get_code (): 3 Source = List ('0123456789')4for in Range (123):5 source.append (Chr (i))6 print( '. Join (Random.sample (source, 4)))
1 def V_code (): 2 "' 3 for in range (5):4 add = Random.choice ([Random.randrange], Chr (Random.randrange ( (123)])5 code + = str (add)6 print(code)
Python3----output all uppercase and lowercase letters and numbers