Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit746c000

Browse files
try 25
1 parent03b5bd4 commit746c000

31 files changed

+43
-8
lines changed

‎25.py

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,57 @@
11
importrequests
2+
importwave
23

34

45
defmain():
56
seed="http://www.pythonchallenge.com/pc/hex/"
67
file_path="lake/"
7-
first_step(seed,file_path)
8+
auth= ("butter","fly")
9+
# first_step(seed, file_path, auth)
10+
bs=second_step()
11+
third_step(bs)
812

913

10-
deffirst_step(seed,file_path):
11-
foriinrange(2,26):
12-
url=seed+str(i)+".wav"
14+
deffirst_step(seed,file_path,auth):
15+
foriinrange(1,26):
16+
url=seed+"lake"+str(i)+".wav"
1317
file_name=file_path+str(i)+".wav"
14-
download_a_file(url,file_name)
18+
download_a_file(url,file_name,auth)
1519

1620

17-
defdownload_a_file(url,file_name):
18-
res=requests.get(url)
21+
defdownload_a_file(url,file_name,auth):
22+
res=requests.get(url,auth=auth)
1923
bs=res.content
2024
file=open(file_name,"wb")
2125
file.write(bs)
2226
print("Download {}".format(file_name))
2327

2428

29+
defsecond_step():
30+
bsAry= []
31+
foriinrange(1,26):
32+
lake=wave.open("lake/{}.wav".format(i),"rb")
33+
bs=lake.readframes(lake.getnframes())
34+
print(bs)
35+
bsAry.append(bs)
36+
lake.close()
37+
returnbsAry
38+
39+
40+
defthird_step(bs):
41+
result_file=wave.open("lake/result.wav","wb")
42+
src_file=wave.open("lake/1.wav","rb")
43+
nframes=src_file.getnframes()
44+
result_file.setnchannels(src_file.getnchannels())
45+
result_file.setsampwidth(src_file.getsampwidth())
46+
result_file.setframerate(src_file.getframerate())
47+
result_file.setnframes(nframes*25)
48+
foriinrange(len(bs)):
49+
b=bs[i]
50+
result_file.writeframesraw(b)
51+
src_file.close()
52+
result_file.close()
53+
print("Done")
54+
55+
2556
if__name__=="__main__":
2657
main()

‎lake/1.wav

10.6 KB
Binary file not shown.

‎lake/10.wav

10.2 KB
Binary file not shown.

‎lake/11.wav

10.2 KB
Binary file not shown.

‎lake/12.wav

10.2 KB
Binary file not shown.

‎lake/13.wav

10.2 KB
Binary file not shown.

‎lake/14.wav

10.2 KB
Binary file not shown.

‎lake/15.wav

10.2 KB
Binary file not shown.

‎lake/16.wav

10.2 KB
Binary file not shown.

‎lake/17.wav

10.2 KB
Binary file not shown.

‎lake/18.wav

10.2 KB
Binary file not shown.

‎lake/19.wav

10.2 KB
Binary file not shown.

‎lake/2.wav

10.2 KB
Binary file not shown.

‎lake/20.wav

10.2 KB
Binary file not shown.

‎lake/21.wav

10.2 KB
Binary file not shown.

‎lake/22.wav

10.2 KB
Binary file not shown.

‎lake/23.wav

10.2 KB
Binary file not shown.

‎lake/24.wav

10.2 KB
Binary file not shown.

‎lake/25.wav

10.2 KB
Binary file not shown.

‎lake/3.wav

10.2 KB
Binary file not shown.

‎lake/4.wav

10.2 KB
Binary file not shown.

‎lake/5.wav

10.2 KB
Binary file not shown.

‎lake/6.wav

10.2 KB
Binary file not shown.

‎lake/7.wav

10.2 KB
Binary file not shown.

‎lake/8.wav

10.2 KB
Binary file not shown.

‎lake/9.wav

10.2 KB
Binary file not shown.

‎lake/result.wav

264 KB
Binary file not shown.

‎maze/maze/maze.jpg

19.2 KB
Loading

‎maze/maze/mybroken.gif

2.74 KB
Loading

‎maze/maze/mybroken.zip

2.64 KB
Binary file not shown.

‎read-bin-file.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ def read_bin_file(file_path):
1313
if__name__=="__main__":
1414
# read_bin_file("copper/white.gif")
1515
# read_bin_file("channel/channel.zip")
16-
read_bin_file("maze/maze.zip")
16+
# read_bin_file("maze/maze.zip")
17+
# read_bin_file("lake/2.wav")
18+
# read_bin_file("indian/indian.wav")
19+
# read_bin_file("indian/result.wav")
20+
read_bin_file("maze/maze/mybroken.gif")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp