In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to randomly generate uppercase and lowercase alphanumeric mixed passwords by python". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how python can randomly generate mixed uppercase and lowercase alphanumeric passwords.
Use a simple method to generate random passwords
Randomly generate passwords with only 20 lines of code
Core idea: using random module
The random module randomly generates numbers, uppercase and lowercase letters, and cycles.
While cycle + number of randomly generated cycles-- > Random plus++
Capital letters ASKII code between 65 and 90
Lowercase letters Askll code between 97-122,
Final result: X uppercase letters + y digits + z lowercase letters (x _ z is random.
Randomness compared to the previous monotonous lowercase + number + uppercase + lowercase + number + uppercase. The cycle has improved.
Import randomprint ("Random number Generation") time=random.randint (1Magne2) while time: time1=random.randint (1,3) time2=random.randint (1Magne2) time3=random.randint (1,3) while time1: a = random.randint (65Power90) print ("% c"% an Endend = "") time1-=1 while time2: C = random.randint (0Magne99) print ("% d"% c Endend = ") time2-=1 while time3: B = random.randint (97122) print ("% c "% b) End= "") time 3 words 1 time-=1
Add: randomly generate a six-digit CAPTCHA with Python (CAPTCHA consists of numbers and letters (uppercase and lowercase letters))
Import random, the randint function module that randomly generates an interval integer in the random function here knows for the first time that a loop can use for _ in range (): hhh, Def generate_code (code_len = 6): all_char = '0123456789qazwsxedcrfvtgbyhnujmikolpQAZWSXEDCRFVTGBYHNUJIKOLP' index = len (all_char) + 1 code =' 'for _ in range (code_len): num = random.randint (0) Index) code + = all_ char [num] return codeprint (generate_code ())
At this point, I believe you have a deeper understanding of "how to randomly generate uppercase and lowercase alphanumeric mixed passwords by python". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 245
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.