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 31 32 33 34 35
| from borax.calendars.lunardate import LunarDate
dict_list = ['大安(上上)', '留连(中)', '速喜(上)', '赤口(中下)', '小吉(中上)', '空亡(下)'] time_list = ["子时:00-02点", "丑时:02-04点", "寅时:04-06点", "卯时:06-08点", "辰时:08-10点", "巳时:10-12点", "午时:12-14点", "未时:14-16点", "申时:16-18点", "酉时:18-20点", "戌时:20-22点", "亥时:22-24点"]
s_year = 2022 s_month = 2 s_day = 13 print('公历 ', s_year, '年', s_month, '月', s_day, '日')
lunar_date = LunarDate.from_solar_date(s_year, s_month, s_day) month = lunar_date.month day = lunar_date.day print(lunar_date.strftime('%G')) print('农历 ', month, '月', day, '日') print("===================")
index_month = (month - 1) % 6 result_month = dict_list[index_month] print("本月运势:" + result_month) print("===================")
index_day = (index_month + day - 1) % 6 result_day = dict_list[index_day] print("本日运势:" + result_day) print("===================")
for index in range(0, 12): print(time_list[index] + " 运势:" + dict_list[(index + index_day) % 6])
|