pythonchallenge_level3

level3

地址:http://www.pythonchallenge.com/pc/def/equality.html
源码:git@code.aliyun.com:qianlizhixing12/PythonChallenge.git。
问题:找出页面源码一点提示注释中的前后有三个大写字符的小写字符。

#!/usr/bin/env python3
# -*- coding:UTF-8 -*-

# Level 3

import urllib.request

url = "http://www.pythonchallenge.com/pc/def/equality.html"
response = urllib.request.urlopen(url)
body = response.read()
response.close

import re

body = body.decode("utf8")
text = re.search("<!--\n(.|\s)+\n-->", body).group(0)
lis = re.findall("[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]", text)
print("Level 3:", ''.join(lis))
上一篇:pythonchallenge_level4


下一篇:pythonchallenge_level13