1, beautifulsoup is a useful python-written html/xml parser that can handle nonstandard tags and generate a parse tree. BeautifulSoup can manipulate the note object.
Tag (corresponding to the label in HTML)
Tag.attrs (all properties of the tag are returned as a dictionary)
You can add, delete, and change the properties of the tag directly.
2, python regular expression results, Re.search.group () is used to extract the string that is intercepted by the packet match, () the number within the () is used to denote the grouping
1) group () is the same group (0) that matches the regular expression overall result
Group (1) lists the first brace matching part, Group (2) lists the second bracket matching part, Group (3) lists the third bracket matching part, and so on;
2.) No match succeeded, Re.search () returns none;
3.) There are no parentheses in the regular expression, and group (1) has an error.
3, The difference between Re.match and Re.search: Re.match matches only the beginning of the string, if the string starts not conforming to the regular expression, the match fails, the function returns none, and the Re.search matches the entire string until a match is found; Re.sub is used to replace the match in the string;
4, l Ambda : This is a funny syntax that Python supports, It allows you to quickly define the minimum function of a single line, similar to a macro in C;
>>> g = lambda x:x * 2 
>>> g (3)
6
>>> (Lambda x:x * 2) (3) ;
6
Python Learning notes