python 正则表达式怎么提取以https开头的字符串?

如题所述

输入的字符串格式是?给个输入例子,有助于给出有效的具体方案。追问

你看一下怎么改

温馨提示:答案为网友推荐,仅供参考
第1个回答  2021-10-18

你的字符串中间少了一个逗号吧,你可以看下我写的


import re
a = "http://231231", "https://4234923"
for i in list(a):
s = re.findall("(.+?):", i)
if str(s[0]) == "https":
print(i)
else:
pass


结果: