#
constellation_dict={"摩羯座":[12,22],
"水瓶座": [1,20 ],
"双鱼座": [2, 19],
"白羊座": [3,21 ],
"金牛座": [4, 20],
"双子座": [5,21 ],
"巨蟹座": [6,22 ],
"狮子座": [7,23 ],
"处女座": [8,23 ],
"天秤座": [9, 23],
"天蝎座": [10, 24],
"射手座": [11, 23],
}
#通过星座找到月份
def GetConstellationDate (constellation,day):
datas= constellation_dict.get(constellation)
if datas[1]<day:#如果日期大于就是本月否则相加
return datas[0]
else:
month=datas[0]+1
month=month%12
return month
if __name__ == '__main__':
month= GetConstellationDate("天秤座",28)
print(month)
因为需求需要通过星座 获取月份