No. 0 Pass:
Computes the n-th side of x: X**n
First Pass:
Maketrans (from,to): Set up a translation rule that translates the from translation to A to, because the lengths of the two parameters must be the same
Translate (Table[,deletechars]): Translation of a string using the translation rules above
Example
1 # -*-coding:utf-8-*- 2 Import string 3 3 table = String.maketrans ('a'b') 4print'make'. Translate (table)
Second Pass:
The Python Isalpha () method detects whether a string consists of only letters.
# -*-coding:utf-8-*- # cannot have spaces in a string " Helloword " ; Print "Hello Word"; print str.isalpha ();
Third Pass:
The general step for using RE is to use the Re.compile () function, compile the string form of the regular expression into a pattern instance, then use the pattern instance to process the text and get the matching result (a match instance), and finally use the match instance to get the information. To do other things.
re. Match(pattern, string, flags=0) :p attern-> matching Regular expression;string-> the string;flags-> flag bits to match to control how regular expressions are matched, such as: case-sensitive, Multi-line matching and so on.
Re.findall (b): Find all the locations in string B that match regular expression A and put them in a list;
1 Re.complie (a) 2 3 a.findall (b)
Re module is one of the most commonly used Python modules, there are many tutorials on the web, no longer repeat here, you can go to the novice tutorial to see.
Four-off:
Review re module, introduce Urllib, about Urllib module, will be detailed later
# ==========================================================================
Cracked to the four has been tired. Good programming ability low, need to improve
, go to work for two days and then play.
-----Python Pupils
Pythonchallenge learned Python built-in function collation