Python カレンダー生成

Document 对象参考手册Python3 例

以下のコードは、指定した日付のカレンダーを生成します:

例(Python 3.0+)

# Filename : test.py # author by : www.example.com # カレンダーモジュールをインポート import calendar # 指定した年月を入力 yy = int(input("年を入力:")) mm = int(input("月を入力:")) # カレンダーを表示 print(calendar.month(yy,mm))

上記のコードを実行した出力結果:

输入年份: 2015
输入月份: 6
     June 2015
Mo Tu We Th Fr Sa Su
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

Document 对象参考手册Python3 例

その他の拡張