1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

時間と今日の天気を表示させてみたw

Last updated at Posted at 2016-10-20

どうもこんにちわ。
現役学生のrirocanです

時間と今日の天気を表示させてみたw

time.py

# -*- coding: utf-8 -*-
import datetime#基本的な日付型および時間型
import multiprocessing#API を使ってプロセスを生成することができる。
import urllib2, sys#URL を開くための拡張可能なライブラリ。
import json

try: citycode = sys.argv[1]
except: citycode = '090010' #デフォルト地域

todaydetail  =    datetime.datetime.today()# 今日の日付
resp = urllib2.urlopen('http://weather.livedoor.com/forecast/webservice/json/v1?city=%s'%citycode).read()#今日の天気
resp = json.loads(resp)
print '----------------------------------------------------------------------------------------'

print todaydetail# 今日の日付
print '----------------------------------------------------------------------------------------'
print resp['title']#今日の天気
print resp['description']['text']
print '----------------------------------------------------------------------------------------'


1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?