How to use sxtwl - 3 common examples

To help you get started, we’ve selected a few sxtwl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github china-testing / python-api-tesing / bazi / luohou.py View on Github external
print(item + zhi_time[item], end='')
    
    
    day_ganzhi = gans[2] + zhis[2]
    
    if day_ganzhi == year_hous[zhis[0]]:
        print(" \t年猴:{}年{}日".format(zhis[0], day_ganzhi), end=' ')
        
        
    if zhis[2] == yue_hous[ymc[cal_day.Lmc]]:
        print(" \t月罗:{}日".format(zhis[2]), end=' ')
    
    if day_ganzhi in tuple(ji_hous.values()):       
        birthday = d  
        for i in range(30):    
            day_ = sxtwl.Lunar().getDayBySolar(birthday.year, birthday.month, birthday.day)
            if day_.qk != -1:
                ji = jis[(day_.qk + 3)//6]
                break        
            birthday += datetime.timedelta(days=-1)
           
        if day_ganzhi == ji_hous[ji]:
            print(" \t季猴:{}季{}日".format(ji, ji_hous[ji]), end=' ')    
    print()
github china-testing / python-api-tesing / bazi / luohou.py View on Github external
def get_hou(d):
    lunar = sxtwl.Lunar();
    cal_day = lunar.getDayBySolar(d.year, d.month, d.day)
    
    
    # 计算甲干相合    
    gans = Gans(year=Gan[cal_day.Lyear2.tg], month=Gan[cal_day.Lmonth2.tg], 
                day=Gan[cal_day.Lday2.tg])
    zhis = Zhis(year=Zhi[cal_day.Lyear2.dz], month=Zhi[cal_day.Lmonth2.dz], 
                day=Zhi[cal_day.Lday2.dz])
    
    
    print("公历:", end='')
    print("{}年{}月{}日".format(cal_day.y, cal_day.m, cal_day.d), end='')
    
    Lleap = "闰" if cal_day.Lleap else ""
    print("\t农历:", end='')
    print("{}年{}{}月{}日  ".format(cal_day.Lyear0 + 1984, Lleap, ymc[cal_day.Lmc], rmc[cal_day.Ldi]), end='')
github tt67wq / euler_project / xuanxue / zhouyi.py View on Github external
def gua_by_time():
    """
    年月日时起卦例子:
    年月日为上卦。年月日加时总数为下卦。又以年月日时总数取爻。
    如子年一数,丑年二数,直至亥年十二数。
    月如正月一数,直至十二月,亦作十二数。
    日数如初一一数,直至三十日,为三十数。
    以上年月日共计几数,以八除之,以余数作卦。
    如子时一数直至亥时十二数,就将年月日数加时之数,总计几数,以八除之,余数作下卦;以六除,余数作动爻。
    """
    lunar = sxtwl.Lunar()
    a = datetime.datetime.now()
    day = lunar.getDayBySolar(a.year, a.month, a.day)
    y = day.Lyear2.dz+1
    m = day.Lmc-1
    d = day.Ldi+1
    h = a.hour//2+1

    shang_gua = (y+m+d) % 8
    xia_gua = (y+m+d+h) % 8
    yao = (y+m+d+h) % 6
    return {
        "上卦": ZhouYi.Gua[shang_gua-1],
        "下卦": ZhouYi.Gua[xia_gua-1],
        "动爻": yao
    }

sxtwl

sxtwl_cpp warpper for python

BSD-3-Clause
Latest version published 3 months ago

Package Health Score

69 / 100
Full package analysis

Popular sxtwl functions