皆様いつもお世話になっております。
こちらのコードを読み解いているのですが、
python お天気apiから近日の天気を取得する
Python
1#encoding:utf-8 2import urllib2, sys 3import json 4 5try: citycode = sys.argv[1] #<----この変数はcitycodeに何を代入しているのでしょうか? 6except: citycode = '460010' 7resp = urllib2.urlopen('http://weather.livedoor.com/forecast/webservice/json/v1?city=%s'%citycode).read() 8 9 10resp = json.loads(resp) 11print '**************************' 12print resp['title'] 13print '**************************' 14print resp['description']['text'] 15 16for forecast in resp['forecasts']: 17 print '**************************' 18 print forecast['dateLabel']+'('+forecast['date']+')' 19 print forecast['telop'] 20print '**************************'
5行目のcitycodeに何を代入しているのでしょうか?
ご教授のほどよろしくお願い申し上げます。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。