iT邦幫忙

2

Python 東亞曆法模組的簡單應用例子

#!/usr/bin/env python3

import eacal
from datetime import datetime

print("東亞節氣部分範例:")
c_t = eacal.EACal(zh_t=True)
chg = 1
for x in c_t.get_annual_solar_terms(2019):
  if chg == 1:
    print ("%2d %s %s" % (x[1], x[0], datetime.strftime(x[2], "%Y-%m-%d %H:%M %Z")),end="\t")
  else:
    print ("%2d %s %s" % (x[1], x[0], datetime.strftime(x[2], "%Y-%m-%d %H:%M %Z")))
  chg *= -1
  
print("\n以下是越南的")
c_v = eacal.EACal(vi=True)
for x in c_v.get_annual_solar_terms(2019):
  print ("%2d %s %s  " % (x[1], x[0], datetime.strftime(x[2], "%Y-%m-%d %H:%M %Z")), end="")

print()

https://ithelp.ithome.com.tw/upload/images/20200316/2005064709SCPdAZVN.png


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言