Idea one: str= ' Abcd.....xyz0123456789abcd .... XYZ '
Idea two: str1= ' abcd ... ' str2= ' abcd .... XYZ ' str3= ' 0123456789 '
Idea three: Introduce string using String.ascii_lowercase, etc.
Idea four: the introduction of ASCII using random and regular current feeling is relatively correct to be optimized
1 #-*-coding:utf-8-*-2 #@Time: 2018/10/8 16:243 #@Author: Wangyafeng4 #@Email: [Email protected]5 #@Software: Pycharm6 7 8 ImportRandom,re9 TenCheckcode ="' One forIinchRange (8): ACurrent = Random.randrange (0,100) - #Letters - ifcurrent%2==0: theTMP=CHR (Random.randint (65,90)) -Checkcode + =STR (TMP) - elifcurrent%3==0: -TMP=CHR (Random.randint (97,122)) +Checkcode + =STR (TMP) - #Digital + Else: ATmp=random.randint (0,9) atCheckcode + =STR (TMP) - - #matchobj=re.match (' ^[a-za-z0-9]{8}$ ', Checkcode) -Matchobj=re.match ('^(?=.*?[ A-z]) (? =.*?[ A-z]) (? =.*?[ 0-9]). {8}$', Checkcode) - ifMatchobj: - Print(Checkcode) in Else: - Print("please regenerate")
Quiz: Generate 8-bit passwords with uppercase, lowercase letters, and numbers