1.python正则表达式提取所有小括号里的字符串
import re
str = u'陈奕迅演唱(十年)、(浮夸)、(不要说话)'
print (re.findall('\((.*?)\)', str))
'''
打印结果:['十年', '浮夸', '不要说话']
'''
2.python正则表达式提取字符串中间想要的内容
import re
num = "<p>已有<em class='blue' id='howmuchreadBook'>2547</em>人次读过此书...</p>"
sums = re.findall(r"\'howmuchreadBook\'\>(.*?)\<\/em\>",num)
print(sums)
'''
打印结果:['2547']
'''
3.提取字符串中的数字
totalCount = '100abc'
totalCount = re.sub("\D", "", totalCount)
totalCount = re.findall("(.\d+)",totalCount )[0]