天干地支(出生年月的转换)

 

十  天干:
甲(jiǎ)、乙(yǐ)、丙(bǐng)、丁(dīng)、戊(wù)、己(jǐ)、庚(gēng)、辛(xīn)、壬(rén)、癸(guǐ)。
十二   地支:
子(zǐ)、丑(chǒu)、寅(yín)、卯(mǎo)、辰(chén)、巳(sì)、午(wǔ)、未(wèi)、申(shēn)、酉(yǒu)、戌(xū)、亥(hài)。
十二地支对应十二生肖:
子-鼠,丑-牛,寅-虎,卯-兔,辰-龙,巳-蛇, 午-马,未-羊,申-猴,酉-鸡,戌-狗,亥-猪。
接下来是真正起作用的部分啦:

天干地支(出生年月的转换)_第1张图片


 星座:(网上可能有其他的星座日期和这个不一样)
 

天干地支(出生年月的转换)_第2张图片

天干地支(出生年月的转换)_第3张图片

 

S1=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]#天干
S2=["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]#地支
S3=["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
S4=["水瓶座","双鱼座","白羊座","金牛座","双子座","巨蟹座","狮子座","处女座","天秤座","天蝎座","射手座","摩羯座"]#星座

n1=input("请输入年份例如:(2019.09.05):")
x=eval(n1[3])
y=eval(n1[0:4])
z=y%12
if eval(n1[5])==0:
    a=eval(n1[6])
elif eval(n1[5])!=0:
    a=eval(n1[5:7])
if eval(n1[5])==0:
    m=eval(n1[6:])
elif eval(n1[5])!=0:
    m=eval(n1[5:])
m=int(m*100)
print(m)
if m in range(120,211):
    i=0
elif m in range(219,321):
    i=1
elif m in range(321,420):
   i=2
elif m in range(420,521):
    i=3
elif m in range(521,622):
    i=4
elif m in range(622,723):
    i=5
elif m in range(723,823):
   i=6
elif m in range(823,923):
   i=7
elif m in range(923,1024):
    i=8
elif m in range(1024,1123):
    i=9
elif m in range(1123,1222):
    i=10
elif m in range(1222,120):
    i=11
print("您出生于{}{}年,属{},你的星座为{}".format(S1[(x-4)%10],S2[(z+8)%12],S3[(z+8)%12],S4[i]))



天干地支(出生年月的转换)_第4张图片


 

你可能感兴趣的:(python)