这是正则表达式代码:without_header = re.findall('/sports/[a-z0-9\/\.\-\:]*[0-9\.]+cms', without_header_url)它返回每个 URL 的输出,该 URL 前面没有 https 标头。例如:/sports/cricket/ipl/top-stories/kxip-vs-csk-shane-watson-faf-du-plessis-infuse-life-into-csks-ipl-campaign-shape-confidence-boosting-win-over-kxip/articleshow/78481088.cms'
/sports/football/epl/top-stories/epl-manchester-united-humiliated-as-mourinhos-spurs-win-6-1-at-old-trafford/articleshow/78481304.cms为此,我想在开头附加“https://example.com”。我不需要 for 循环,有没有使用 re.sub 的有效方法?
添加回答
举报
0/150
提交
取消