Generate random password , English case and number combination .
call GetCode
Method ,num
Parameter setting password digits .
import string
from random import choices
def GetCode(num:int) ->str:
us_lower = [cell for cell in string.ascii_lowercase]
us_upper = [cell for cell in string.ascii_uppercase]
num = [cell for cell in string.digits]
return "".join([choices(us_lower + us_upper + num)[0] for index in range(num)])
if __name__ == "__main__":
code = GetCode(4)
print(code)