import re # Standard regex module
# The ReGeX
regex = re.compile('([\\.a-zA-Z0-9-]+)(?=\\.[a-z]{3,5})')
# The document to extract websites (suffix excluded) from
doc = """
str1="Google.com"
str2="yahoo.com"
str3="redcross.org"
"""
# Find websites (without the suffix) like so:
found_websites = regex.findall(doc)
# Confirm by printing
print(found_websites)
在python中,您可以这样做
尝试:
输出:
功能性证明:proof
编辑:我制作了一个信息更丰富的网站查找工具(我认为这不是你想要的,但可能认为有用)here
相关问题 更多 >
编程相关推荐