閱讀437 返回首頁    go 阿裏雲 go 技術社區[雲棲]


pythonchallenge_level3

level3

地址:https://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 = "https://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))

最後更新:2017-10-01 07:33:18

  上一篇:go  pythonchallenge_level4
  下一篇:go  pythonchallenge_level2