输入:asjkd http://www.as.com/as/g/ff askl
预期输出:http://www.as.com/as/g/ff
当我在下面尝试时,我得到了预期的输出
pattern=re.compile(r'http[\w./:]+')
print(pattern.search("asjkd http://www.as.com/as/g/ff askl"))为什么这里的量词不贪婪?我以为它会很贪婪。在这里,实际上不贪婪有助于找到正确的答案。+
慕后森
繁花不似锦
随时随地看视频慕课网APP
相关分类