Monday, October 31, 2011

[Py] The Python Challenge -- Level 05

Here is a note of my solution to solve Level 05 of The Python Challenge.

The main library used is the pickle.

Actually I didn't know pickle before. I just noticed the ``banner.p'' file shown in the source. When I viewed the banner.p file, I noticed the strange characters could be transferred to meaningful or readable messages.

The pickle module was found by paste few characters in the banner.p file into Google for searching. There was a thread mentioned about the pickle module, so I decided to start with it and got right result.

The original version of my code is as the follows.

import pickle

tmp_list = pickle.load( open('banner.p', 'rb') )

for row in range( len(tmp_list) ):
    for elem in range( len(tmp_list[row]) ):
        for repeat in range(tmp_list[row][elem][1]):
            print(tmp_list[row][elem][0], end="")

No comments:

Post a Comment