File tree Expand file tree Collapse file tree 3 files changed +125
-0
lines changed Expand file tree Collapse file tree 3 files changed +125
-0
lines changed Original file line number Diff line number Diff line change 1+ import download_file
2+ import bz2
3+
4+
5+ def main ():
6+ url = "http://www.pythonchallenge.com/pc/ring/guido.html"
7+ file_path = "silent/guido.html"
8+ user = "repeat"
9+ password = "switch"
10+ # first_step(url, file_path, user, password)
11+ second_step (file_path )
12+
13+
14+ def first_step (url , file_path , user , password ):
15+ download_file .download_with_auth (url , file_path , user , password )
16+
17+
18+ def second_step (file_path ):
19+ file = open (file_path , "r" )
20+ count = 0
21+ result = ""
22+ while True :
23+ count += 1
24+ line = file .readline ()
25+ if line :
26+ if count >= 13 :
27+ result += chr (len (line ) - 1 )
28+ else :
29+ break
30+ print ("result = " + result )
31+ dec_result = bz2 .decompress (result .encode ("latin1" ))
32+ print (dec_result )
33+
34+
35+ if __name__ == "__main__" :
36+ main ()
Original file line number Diff line number Diff line change 11# pythonchallenge
22Solve Problems in http://www.pythonchallenge.com
33
4+ #### 29
5+ result: http://www.pythonchallenge.com/pc/ring/yankeedoodle.html
6+ - do you find these unnecessary empty lines in the source page of guido.html
7+
8+
49#### 28
510result: http://www.pythonchallenge.com/pc/ring/guido.html
611- use image.split() to split RGB channels
Original file line number Diff line number Diff line change 1+ < html >
2+ < head >
3+ < title > silence!</ title >
4+ < link rel ="stylesheet " type ="text/css " href ="../style.css ">
5+ </ head >
6+ < body >
7+ < br > < br >
8+ < center >
9+ < font color ="gold ">
10+ < img src ="whoisit.jpg " border ="0 "/>
11+ </ body >
12+ </ html >
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
You can’t perform that action at this time.
0 commit comments