반응형
페이지 소스 내에서 3개의 대문자 사이에 소문자를 찾아내는 문제이다.
공략법
1. 웹소스를 크롤링하여 문제에 접근한다.
2. 많은 문자열을 처리하므로 정규표현식을 사용한다.
import urllib.request
import re
html='http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing='
response = requests.get(html+'63579')
i=0
while i<400:
i+=1
nem = response.text
data=re.findall("[0-9]+",nem)
# datastr=data[0]
print(response.text,data)
response = requests.get(html+data[0])import re
file=open('q3.txt','r')
data =file .read()
mata = re.findall("[a-z][A-Z]{3}[a-z][A-Z]{3}[a-z]",data)
answer=""
for i in mata:
answer += i[4]
print(answer)
#linkedlist
반응형
'Python > The Python Challenge' 카테고리의 다른 글
The Python Challenge 4 (0) | 2021.01.09 |
---|---|
The Python Challenge 2 (0) | 2019.06.02 |
The Python Challenge 1 (0) | 2019.06.02 |
The Python Challenge 0 (0) | 2019.06.02 |