下記構文でrequestメソッドが文法エラーとなります。
原因が不明なので、どなたかご教授いただければ存じます
python
1 2import tree 3import requests 4import time 5 6PAGE_URL_LIST = { 7 "http://example.com/1.page", 8 "http://example.com/2.page", 9 "http://example.com/3.page", 10} 11 12for page_url in PAGE_URL_LIST: 13 res = requests.get(page_url.timeout=30) 14 print( 15 "ページURL:" + page_url + "," + \ 16 "処理時間(秒)" + str(res.elased.total_seconds()) 17 ) 18 19 time.sleep(1) 20
エラーの内容
res = requests.get(page_url.timeout=30) ^ SyntaxError: keyword can't be an expression
文法エラーだと思いますが、requests.getの書き方も問題ないと思いますので、原因が不明でございます。。。
下記は動作するので、モジュールのインストールは問題ないと思います
r = requests.get("https://programming-beginner-zeroichi.jp/") print(r.text) ```
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/28 06:31