link_regx = re.compile('<cite.*?>(.*?)<\/cite>')
try:
links_list = link_regx.findall(resp)
for link in links_list:
link = re.sub('<span.*>', '', link)
是什么compile()和sub()在此使用功能
re.compile(pattern,flags = 0)
将正则表达式模式编译为正则表达式对象,可以使用其match(),search()和其他方法进行匹配。
https://docs.python.org/3/library/re.html#re.compile
re.sub(pattern,repl,string,count = 0,flags = 0)
返回用替换代表替换字符串中最左边的非重叠模式所获得的字符串。