Extraction of Chinese characters:
Extracting all the numbers:
. 1 Import Re 2 String = " 16 days plate 11 "
. 3 Number = the re.findall (R & lt " \ D + " , String) # extract all integers
. 4 Print ( ' all numbers: ' , Number)
. 1 Number = the re.findall (R & lt " (<= \ day) \ D +? " , String) # extracts a specified number of characters after 2 Print ( ' the specified character: ' , Number)
. 1 Number = the re.findall (R & lt " (\ + D) board " , String) # extract digital pre-specified character 2 Print ( ' before the specified characters: ' , Number)
1 # into digital 2 Number = list (Map (int, Number)) # the first turn numerical character list . 3 Number Number = [0] # and then read list element . 4 Print ( ' into digital: ' , number)
# Filtered English symbol string, kanji retention STE = the re.sub ( " [A-Za-Z0-9 \! \% \ [\] \, \.] " , "" , String) Print ( ' characters: ' , STE)
Output :
All figures: [ '16', '11']
After the specified character: [ '11']
before the specified character: [ '11']
Converted to numbers: 11
Character: a top plate