回答編集履歴

1

サンプルコード修正

2017/09/13 05:52

投稿

8524ba23
8524ba23

スコア38341

test CHANGED
@@ -14,18 +14,20 @@
14
14
 
15
15
  import socket
16
16
 
17
- print('start')
17
+ urls = ['http://www.google.co.jp','https://t.co/U1QHEjDRhc']
18
18
 
19
- url="https://t.co/U1QHEjDRhc"
19
+ for url in urls:
20
20
 
21
- try:
21
+ print(url)
22
22
 
23
- urllist = (urllib.request.urlopen(url,timeout=3).geturl())
23
+ try:
24
24
 
25
- print(urllist)
25
+ urllist = (urllib.request.urlopen(url,timeout=3).geturl())
26
26
 
27
- except socket.timeout:
27
+ print(urllist)
28
28
 
29
+ except socket.timeout:
30
+
29
- print('timeout')
31
+ print('timeout')
30
32
 
31
33
  ```