Skip to content

Commit

Permalink
modify convert
Browse files Browse the repository at this point in the history
  • Loading branch information
china-testing committed Jul 24, 2022
1 parent 6402e29 commit ce07d48
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 18 deletions.
13 changes: 10 additions & 3 deletions bazi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sizi import summarys
from common import *

def gan_zhi_he(zhu):
gan, zhi = zhu
if ten_deities[gan]['合'] in zhi5[zhi]:
return "|"
return ""

description = '''
Expand Down Expand Up @@ -174,8 +179,10 @@
out = out + "{}{} ".format(item, zhi_6hes[item])
print(' '.join(list(zhis)), ' '*5, ' '.join(list(zhi_shens)), ' '*5, "生:寅申巳亥 败:子午卯酉 库:辰戌丑未", ' '*2, out)
print("-"*120)
print("{1:{0}^15s}{2:{0}^15s}{3:{0}^15s}{4:{0}^15s}".format(chr(12288), '【年】{}:{}{}'.format(temps[gans.year],temps[zhis.year],ten_deities[gans.year].inverse['建']),
'【月】{}:{}{}'.format(temps[gans.month],temps[zhis.month], ten_deities[gans.month].inverse['建']), '【日】{}:{}'.format(temps[me], temps[zhis.day]), '【时】{}:{}{}'.format(temps[gans.time], temps[zhis.time], ten_deities[gans.time].inverse['建'])))
print("{1:{0}^15s}{2:{0}^15s}{3:{0}^15s}{4:{0}^15s}".format(chr(12288), '【年】{}:{}{}{}'.format(temps[gans.year],temps[zhis.year],ten_deities[gans.year].inverse['建'], gan_zhi_he(zhus[0])),
'【月】{}:{}{}{}'.format(temps[gans.month],temps[zhis.month], ten_deities[gans.month].inverse['建'], gan_zhi_he(zhus[1])),
'【日】{}:{}{}'.format(temps[me], temps[zhis.day], gan_zhi_he(zhus[2])),
'【时】{}:{}{}{}'.format(temps[gans.time], temps[zhis.time], ten_deities[gans.time].inverse['建'], gan_zhi_he(zhus[3]))))
print("-"*120)


Expand All @@ -185,7 +192,7 @@
gans.year, yinyang(gans.year), gan5[gans.year], ten_deities[me][gans.year], check_gan(gans.year, gans)),
'{}{}{}【{}】{}'.format(
gans.month, yinyang(gans.month), gan5[gans.month], ten_deities[me][gans.month], check_gan(gans.month, gans)),
'{}{}{}【{}】{}'.format(me, yinyang(me),gan5[me], '天', check_gan(me, gans)),
'{}{}{}{}'.format(me, yinyang(me),gan5[me], check_gan(me, gans)),
'{}{}{}【{}】{}'.format(gans.time, yinyang(gans.time), gan5[gans.time], ten_deities[me][gans.time], check_gan(gans.time, gans)),
))

Expand Down
9 changes: 7 additions & 2 deletions convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# CreateDate: 2019-2-21

import argparse

import subprocess

description = '''
'''
parser = argparse.ArgumentParser(description=description,
Expand All @@ -15,6 +16,10 @@
version='%(prog)s 0.1 Rongzhong xu 2019 4 12 钉钉或微信pythontesting')
options = parser.parse_args()

result = ''
for item in zip(options.gans, options.zhis):
print("".join(item), end=' ')
result = result + "".join(item) + " "

#subprocess.call("cls", shell=True)
print(result)
print(subprocess.check_output("python bazi.py -b " + result, shell=True).decode('gbk'))
1 change: 1 addition & 0 deletions datas.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
'''
}

up_down_hes = (('戊','子'),('辛','巳'), ('壬','午'), ('丁','亥'))

lu_types = {
"甲":{('丙','寅'):'福星禄 名位禄 吉', ('戊','寅'):'伏马禄 吉',
Expand Down
117 changes: 104 additions & 13 deletions ganzhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,18 @@


zhi_atts = {
"子":{"冲":"午", "刑":"卯", "被刑":"卯", "合":("申","辰"), "会":("亥","丑"), '害':'未', '破':'酉', "六合":"丑","暗合":"",},
"丑":{"冲":"未", "刑":"戌", "被刑":"未", "合":("巳","酉"), "会":("子","亥"), '害':'午', '破':'辰', "六合":"子","暗合":"寅",},
"寅":{"冲":"申", "刑":"巳", "被刑":"申", "合":("午","戌"), "会":("卯","辰"), '害':'巳', '破':'亥', "六合":"亥","暗合":"丑",},
"卯":{"冲":"酉", "刑":"子", "被刑":"子", "合":("未","亥"), "会":("寅","辰"), '害':'辰', '破':'午', "六合":"戌","暗合":"申",},
"辰":{"冲":"戌", "刑":"辰", "被刑":"辰", "合":("子","申"), "会":("寅","卯"), '害':'卯', '破':'丑', "六合":"酉","暗合":"",},
"巳":{"冲":"亥", "刑":"申", "被刑":"寅", "合":("酉","丑"), "会":("午","未"), '害':'寅', '破':'申', "六合":"申","暗合":"",},
"午":{"冲":"子", "刑":"午", "被刑":"午", "合":("寅","戌"), "会":("巳","未"), '害':'丑', '破':'卯', "六合":"未","暗合":"亥",},
"未":{"冲":"丑", "刑":"丑", "被刑":"戌", "合":("卯","亥"), "会":("巳","午"), '害':'子', '破':'戌', "六合":"午","暗合":"",},
"申":{"冲":"寅", "刑":"寅", "被刑":"巳", "合":("子","辰"), "会":("酉","戌"), '害':'亥', '破':'巳', "六合":"巳","暗合":"卯",},
"酉":{"冲":"卯", "刑":"酉", "被刑":"酉", "合":("巳","丑"), "会":("申","戌"), '害':'戌', '破':'子', "六合":"辰","暗合":"",},
"戌":{"冲":"辰", "刑":"未", "被刑":"丑", "合":("午","寅"), "会":("申","酉"), '害':'酉', '破':'未', "六合":"卯","暗合":"",},
"亥":{"冲":"巳", "刑":"亥", "被刑":"亥", "合":("卯","未"), "会":("子","丑"), '害':'申', '破':'寅', "六合":"寅","暗合":"午",},
"子":{"冲":"午", "刑":"卯", "被刑":"卯", "合":("申","辰"), "会":("亥","丑"), '害':'未', '破':'酉', "":"丑","暗合":"",},
"丑":{"冲":"未", "刑":"戌", "被刑":"未", "合":("巳","酉"), "会":("子","亥"), '害':'午', '破':'辰', "":"子","暗合":"寅",},
"寅":{"冲":"申", "刑":"巳", "被刑":"申", "合":("午","戌"), "会":("卯","辰"), '害':'巳', '破':'亥', "":"亥","暗合":"丑",},
"卯":{"冲":"酉", "刑":"子", "被刑":"子", "合":("未","亥"), "会":("寅","辰"), '害':'辰', '破':'午', "":"戌","暗合":"申",},
"辰":{"冲":"戌", "刑":"辰", "被刑":"辰", "合":("子","申"), "会":("寅","卯"), '害':'卯', '破':'丑', "":"酉","暗合":"",},
"巳":{"冲":"亥", "刑":"申", "被刑":"寅", "合":("酉","丑"), "会":("午","未"), '害':'寅', '破':'申', "":"申","暗合":"",},
"午":{"冲":"子", "刑":"午", "被刑":"午", "合":("寅","戌"), "会":("巳","未"), '害':'丑', '破':'卯', "":"未","暗合":"亥",},
"未":{"冲":"丑", "刑":"丑", "被刑":"戌", "合":("卯","亥"), "会":("巳","午"), '害':'子', '破':'戌', "":"午","暗合":"",},
"申":{"冲":"寅", "刑":"寅", "被刑":"巳", "合":("子","辰"), "会":("酉","戌"), '害':'亥', '破':'巳', "":"巳","暗合":"卯",},
"酉":{"冲":"卯", "刑":"酉", "被刑":"酉", "合":("巳","丑"), "会":("申","戌"), '害':'戌', '破':'子', "":"辰","暗合":"",},
"戌":{"冲":"辰", "刑":"未", "被刑":"丑", "合":("午","寅"), "会":("申","酉"), '害':'酉', '破':'未', "":"卯","暗合":"",},
"亥":{"冲":"巳", "刑":"亥", "被刑":"亥", "合":("卯","未"), "会":("子","丑"), '害':'申', '破':'寅', "":"寅","暗合":"午",},
}

kus = {'辰':"水土", '戌':'火土', '丑':'金', '未':'木',}
Expand Down Expand Up @@ -330,4 +330,95 @@ def getGZ(gzStr):
if gzStr[1] == v:
dz = i
break
return sxtwl.GZ(tg, dz)
return sxtwl.GZ(tg, dz)

gan_health = {
"金":'''
秋天较走运
申月、酉月、猴年和鸡年运气较好
下午三点至下午七点是吉时
西方是吉方
住朝西的房子较吉利
睡房在房子的西方较好
睡房的西方有窗字较顺利
金属床有利健康
办公桌朝西有助工作效率
吉祥颜色是白色
室内装璜用白色系统
穿衣用白色系列
开白色车子较平安易发财
勿伤心,注意呼吸系统、肺、肠, 筋
武术、击搏、兵器运动、健身房运动也很好
和金有关的工作较容易''',

"木":'''
春天或清风徐来的天气较走运
卯月、寅月、兔年和虎年运气较好
上午三点至上午七点是吉时
东方是吉方
住朝东的房子较吉利
睡房在房子的东方较好
睡房的东方有窗字较顺利
木床有利健康
办公桌朝东有助工作效率
吉祥颜色是绿色
室内装璜用绿色系统
穿衣用绿色系列
开绿色车子较平安易发财
多喝点酸性饮料,忌生气,注意神精系统、肝、胆、头肩、肝胆
多打高尔夫球、公园散步、徒步树林等户外运动
和木有关的工作较容易。''',

"水":'''
身体需要注意: 胫足、膀胱肾(比如结石) 多喝水
冬天或冷天气较走运
亥月、子月、猪年和鼠年运气较好
晚上九点至上午一点是吉时
北方较冷是吉方
住朝北的房子较吉利
睡房在房子的北方较好
睡房的北方有窗字较顺利
金属床或水床有利健康
办公桌朝北有助工作效率
吉祥颜色是黑色
室内装璜用黑色系统
穿衣用黑色系列,带珠宝也不错
开黑色车子较平安易发财
多喝水,注意肾脏系统
多做游泳、潜水、滑雪、钓鱼、溜冰等户外运动
和水有关的工作较容易。''',

"火":'''
夏天或热天气较走运
午月、巳月、马年和蛇年运气较好
上午九点至下午一点是吉时
南方较热是吉方
住朝南的房子较吉利
睡房在房子的南方较好
睡房的南方有窗字较顺利
木床有利健康
办公桌朝南有助工作效率
吉祥颜色是红色
室内装璜用红色系统
穿衣用红色系列
开红色车子较平安易发财
要常笑,注意心脏系统、血液循环、眼睛、额齿
多做打篮球、网球、排球、骑单车等户外运动
和火有关的工作较容易''',

"土":'''
春、夏、秋、冬四季交接之时段较走运
丑、辰、未、戌月和牛、龙、羊、狗年运气较好
上午二点、八点左右和下午二点、八点左右都是吉时
起居环境和气候不要太乾或太湿
睡房在房子的中间较好
办公桌靠房子的中间,有助工作效率
吉祥颜色是棕黄色
室内装璜用棕黄色系统
穿衣用棕黄色系列,带古玉很不错
开棕黄色车子较平安易发财
勿常担心事情,太多虑
吃些甜点,注意消化系统、脾、肌肉
多做园艺、露营、走路等户外运动。下棋、宗教场所都好
和土有关的工作较容易''',
}

0 comments on commit ce07d48

Please sign in to comment.