[TOC]
re.sub(pattern, repl, string, count=0, flags=0)
# 代码 s = "https://book.douban.com/subject/27031874/?icn=index-editionrecommend/458154564515/" print(re.search(r'/(\d+)/', s).group()) print(re.search(r'/(\d+)/', s).group(1)) # 输出 /27031874/ 27031874
最后更新于4年前
这有帮助吗?