2
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.

めざせpythonライブラリマスター (3)workalendar

Last updated at Posted at 2016-05-30

#【ライブラリ説明】
 さまざまな国の祝日がわかります。

#【プログラム】
 2016年の日本の祝日を取得してみます。

workalendar.py
# -*- coding: utf-8 -*-

from workalendar.asia import Japan

cal = Japan()

for i in xrange(len(cal.holidays(2016))):
    print cal.holidays(2016)[i]

#【結果】
(datetime.date(2016, 1, 1), 'New year')
(datetime.date(2016, 1, 11), 'Coming of Age Day')
(datetime.date(2016, 2, 11), 'Foundation Day')
(datetime.date(2016, 3, 20), 'Vernal Equinox Day')
(datetime.date(2016, 4, 29), 'Showa Day')
(datetime.date(2016, 5, 3), 'Constitution Memorial Day')
(datetime.date(2016, 5, 4), 'Greenery Day')
(datetime.date(2016, 5, 5), "Children's Day")
(datetime.date(2016, 7, 18), 'Marine Day')
(datetime.date(2016, 9, 19), 'Respect-for-the-Aged Day')
(datetime.date(2016, 9, 22), 'Autumnal Equinox Day')
(datetime.date(2016, 10, 10), 'Health and Sports Day')
(datetime.date(2016, 11, 3), 'Culture Day')
(datetime.date(2016, 11, 23), 'Labour Thanksgiving Day')
(datetime.date(2016, 12, 23), "The Emperor's Birthday")

今年は3月21日が振り替え休日でしたが、結果には含まれていない(>_<)

#【感想】
 すべての国の祝日取得に対応してほしいですね。

#【参考サイト】
 workalendar
 github

2
1
2

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
2
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?