In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "python regular expression example usage", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "python regular expression example usage" bar!
Example 1: strong password detection
Topic: write a function that uses regular expressions to ensure that the incoming password string is a strong password. A strong password is defined as not less than 8 characters long, containing both uppercase and lowercase characters, and at least one digit. You may need to test the string with multiple regular expressions to ensure its strength.
Train of thought:
1. The program needs to write a Python function to test the string.
2. Regular expressions are needed to determine whether a string meets condition 1 (not less than 8 characters in length), condition 2 (both uppercase and lowercase characters), and condition 3 (at least one digit).
Implementation: this article provides three ways to write:
1 、
Import re
Def strongPassword (str): # defines regular expression functions
LengthRex1 = re.compile (r'[amurz] +') # create regular expression object 1
LengthRex2 = re.compile (r'[Amurz] +') # create regular expression object 2
LengthRex3 = re.compile (r'[0-9] +') # create regular expression object 3
If len (str)
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: 0
*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.