In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail "what is the syntax of Python3's re.search function", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what is the syntax of Python3's re.search function" can help you solve your doubts.
Re.search method
Re.search scans the entire string and returns the first successful match.
Function syntax:
Re.search (pattern, string, flags=0)
Function parameter description:
Parameter describes the string to be matched by the regular expression string that pattern matches. Flags flag bit, which is used to control how regular expressions are matched, such as case sensitivity, multi-line matching, and so on. See: regular expression modifier-optional Fla
If the match succeeds, the re.search method returns a matching object, otherwise it returns None.
We can use the group (num) or groups () match object function to get the matching expression.
The match object method describes the string of the entire expression that group (num=0) matches, and group () can enter more than one group number at a time, in which case it returns a tuple containing the values corresponding to those groups. Groups () returns a tuple containing all the team strings, from 1 to the contained group number. Example
#! / usr/bin/python3
Import re
Print (re.search ('www',' www.runoob.com'). Span ()) # matches at the starting position
Print (re.search ('com',' www.runoob.com'). Span ()) # does not match at the starting position
The output of the above instance is as follows:
(0,3) (11,14) read here, this article "what is the syntax of Python3's re.search function" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it to understand it. If you want to know more about related articles, you are welcome to follow the industry information channel.
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.