페이팔이 적혀있길래 페이팔에 힌트가 있는줄 알았다.. 하지만 후원을 부탁하는 링크였고...

핵심은 아래 사진과 같이 zip이라는 주석을 볼 수 있다. 이를 통해 zip이라는 파일이 존재한다고 생각하여

http://www.pythonchallenge.com/pc/def/channel.zip 이라는링크를 들어간 결과 하나의 압축파일이 저장되었다.

해당 파일을 열어본 결과 저번 문제풀이와 동일하게 해당 파일을 열어 다음 경로로 이동하는 txt 파일이존재하였다. 또한 readme.txt 파일이 있어서 열어본 결과 아래 내용이 있었다. zip 파일을 이용할 것이고 번호의 시작은 90052이다.

------------------------------------------

welcome to my zipped list.

hint1: start from 90052
hint2: answer is inside the zip

------------------------------------------

이를 처음에 해석하기 위해 압축파일을 풀어서 open을 txt로 지정하여 문제를 푼 결과

Collect the comments.

라는 문구가 출력되었다.

comment가 뭐지? 라고 검색한 결과 zip 파일안에 각각에 파일에는 코멘트가 존재하는데 이것을 읽어서 출력하라는 것이였다.

이를 위해

zip 파일 자체를 불러와 각각의 파일을 내부에 적혀있는 순서대로 넣고 각 comment는 더하여 아래와 같이 출력되도록 하였다.

 

import re
import zipfile

zip_data = zipfile.ZipFile("C:\\Users\\JH\\Desktop\\channel.zip", "r")

def zip_read(txt):
	zip_comment = zip_data.read(str(txt)+".txt").decode('utf-8')
	next_txt = re.sub(r'[^0-9]', '', zip_comment)
	return next_txt

txt = 90052
comment = ""
while True:
    try:
        txt_end = txt
        txt = str(zip_read(txt))
        if txt == "":
            print('end')
            print(txt_end)
            answer = 	zip_comment = zip_data.read(txt_end+".txt").decode('utf-8')
            print("답 : " + answer)
            break
        else:
            comment += zip_data.getinfo(txt+".txt").comment.decode('utf-8')
            next
    except:
        print("why Error")
        break    
    
print(comment)

comment 출력 결과

해당 주소로 들어갔는데 아래와 같은 글이 출력되었다. 여기가 아니니 다시 내용을 보라는 것이였는데

보게되면 oxygen 이라는 알파벳으로 각 단어가 작성된 것을 볼 수 있다.

다음 링크는 oxyzen이다.

 

아래코드는 txt 파일을 순차적으로 읽어오는 코드이다. 작성은 했는데 해당 문제를 풀 때는 필요가 없었다. 하지만 혹시몰라 적어놓는다.

import re

def txt_read(txt):
    txt_data = open('C:\\Users\\JH\\Desktop\\channel\\'+str(txt)+'.txt',"r",encoding = 'utf-8').read()
    next_txt = re.sub(r'[^0-9]', '', txt_data)
    return next_txt

txt = 90052 
while True:
    try:
        txt_end = txt
        txt = txt_read(txt)
        if str(txt) == "":
            print('end')
            print(str(txt_end))
            answer = open('C:\\Users\\JH\\Desktop\\channel\\'+str(txt_end)+'.txt',"r",encoding = 'utf-8').read()
            print("답 : " + answer)
            break
        else:
            next
    except:
        print("why Error")
        break

다음 주소 링크

http://www.pythonchallenge.com/pc/def/oxygen.html

+ Recent posts