Split a string to count

# The "wdnwjfwj we hd 9 # sdfekfmew 2011 " in the figure taken out of the addition result is 2020 
X = " wdnwjfwj WE #. 9 sdfekfmew HD 2011 " 
Y = int (x.split ( '  ' ) [. 4]) + int ( x.split ( '  ' ) [. 3] .split ( ' # ' ) [0]) # remove digital conversion of the data string by adding the divided type 
Print (Y)

 

Guess you like

Origin www.cnblogs.com/xiaokuangnvhai/p/11204222.html