根据星座预测最近运势

from bs4 import BeautifulSoup
import requestsdef check_sign():your_birth_day = input("输入您的生日的日期> ")your_birth_month = input("输入你生日的月份> ")if (int(your_birth_month) == 12 and int(your_birth_day) >= 22) or (int(your_birth_month) == 1 and int(your_birth_day) <= 19):sign = "Capricorn"elif (int(your_birth_month) == 1 and int(your_birth_day) >= 20) or (int(your_birth_month) == 2 and int(your_birth_day) <= 17):sign = "Aquarium"elif (int(your_birth_month) == 2 and int(your_birth_day) >= 18) or (int(your_birth_month) == 3 and int(your_birth_day) <= 19):sign = "Pices"elif (int(your_birth_month) == 3 and int(your_birth_day) >= 20) or (int(your_birth_month) == 4 and int(your_birth_day) <= 19):sign = "Aries"elif (int(your_birth_month) == 4 and int(your_birth_day) >= 20) or (int(your_birth_month) == 5 and int(your_birth_day) <= 20):sign = "Taurus"elif (int(your_birth_month) == 5 and int(your_birth_day) >= 21) or (int(your_birth_month) == 6 and int(your_birth_day) <= 20):sign = "Gemini"elif (int(your_birth_month) == 6 and int(your_birth_day) >= 21) or (int(your_birth_month) == 7 and int(your_birth_day) <= 22):sign = "Cancer"elif (int(your_birth_month) == 7 and int(your_birth_day) >= 23) or (int(your_birth_month) == 8 and int(your_birth_day) <= 22):sign = "Leo"elif (int(your_birth_month) == 8 and int(your_birth_day) >= 23) or (int(your_birth_month) == 9 and int(your_birth_day) <= 22):sign = "Virgo"elif (int(your_birth_month) == 9 and int(your_birth_day) >= 23) or (int(your_birth_month) == 10 and int(your_birth_day) <= 22):sign = "Libra"elif (int(your_birth_month) == 10 and int(your_birth_day) >= 23) or (int(your_birth_month) == 11 and int(your_birth_day) <= 21):sign = "Scorpio"elif (int(your_birth_month) == 11 and int(your_birth_day) >= 22) or (int(your_birth_month) == 12 and int(your_birth_day) <= 21):sign = "Sagittarius"return signdef horoscope(zodiac_sign, day):url = ("https://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-{}.aspx?sign={}".format(day,zodiac_sign))soup = BeautifulSoup(requests.get(url).content, "html.parser")return soup.find("div", class_="main-horoscope").p.textdef main():# while 1:print("Daily Horoscope. \n")print("输入你的星座号码:\n","1. 白羊座-Aries\n","2. 金牛座-Taurus\n","3. 双子座-Gemini\n","4. 巨蟹座-Cancer\n","5. 狮子座-Leo\n","6. 处女座-Virgo\n","7. 天秤座-Libra\n","8. 天蝎座-Scorpio\n","9. 射手座-Sagittarius\n","10. 魔羯座-Capricorn\n","11. 水瓶座-Aquarius\n","12. 双鱼座-Pisces\n","或者,如果您不确定自己的星座,请输入'calculate'",)zodiac_sign = input("number> ")if zodiac_sign != "calculate":print("choose some day:\n", "0-yesterday\n", "1-today\n", "2-tomorrow\n")dayNum = input("enter the day(number)> ")dayMap = {0: 'yesterday', 1: 'today', 2: 'tomorrow'}day = dayMap[int(dayNum)]horoscope_text = horoscope(zodiac_sign, day)print(horoscope_text)else:print("\n好的,别担心。很快你就会通过这个小测验")print("\n恭喜!你绝对是", check_sign())if __name__ == "__main__":main()

python - 简单实现预测最近运势相关推荐

  1. python 比赛成绩预测_Python预测NBA比赛结果

    下载W3Cschool手机App,0基础随时随地学编程导语 利用Python简单地预测一下NBA比赛结果... 这大概就叫蹭热度吧... 毕竟貌似今天朋友圈都在刷NBA相关的内容... 虽然我并不能看 ...

  2. python运势预测程序_Python 爬虫系列之一——每日星座运势

    开个新坑--Python 爬虫系列,最近脑子里有很多非常有趣的想法,但实现起来都需要一些简单的爬虫知识,如果放在趣学 Python 系列,会显得文章太长,干脆拿出来开个新坑.这个系列本质上是为趣学 P ...

  3. python运势预测程序_基于Python的星座运势接口调用代码实例

    [python]代码库#!/usr/bin/python # -*- coding: utf-8 -*- import json, urllib from urllib import urlencod ...

  4. python运势预测程序_星座运势查询示例代码

    #!/usr/bin/python # encoding:utf-8 import urllib2, json, urllib # 2.星座运势查询 data = {} data["appk ...

  5. 属马的人2021年害太岁运势预测

    2021年辛丑年到了,很多属马的朋友都想知道2021年自己运势以及运气如何,从十二地支角度来看,由于午丑穿的原因,属马的人今年为穿害太岁的年,但由于今年月德以及阴贵人同临,因此对属马人而言,此年吉凶参 ...

  6. 属羊的人2021年冲太岁运势预测

    2021年辛丑牛年到了,很多属羊的朋友都想知道自己2021年辛丑牛年运势情况是怎么样的,从十二地支角度来看,因为丑未相冲,对于属羊人而言今年为冲犯太岁之年,加之今年大耗入命,要防长辈身体健康方面问题以 ...

  7. 属猴的人2021年运势预测

    不知不觉2021年辛丑牛年到了,很多属猴的朋友都想知道自己2021年生肖牛年运势情况如何,对于申猴而言,地支丑土为印星,天干辛金为比劫羊刃,以下周易文化天地五哥来给大家详细讲解下属猴的人2021年运势 ...

  8. 利用python实现星座运势查询APP

    利用python实现星座运势查询APP 学习交流,老鸟指导,直播学习可以进我的python学习交流群 # *_* coding:utf8 *_* import jsonimport requests ...

  9. 小程序源码:星座运势,周公解梦-多玩法安装简单

    这是一款以星座运势查询,周公自定义解梦为主的一款小程序 内支持流量主模式插入 多个功能包含如下: 星座查询 星座运势查询 十二生肖查询 生肖运势查询 星座配对 生肖配对 配对排行榜 星盘查询 周公解梦 ...

最新文章

  1. 验证Xcode真伪的方法,来自苹果官网
  2. 他手边有太多事要做了
  3. TensorFlow(一)
  4. LOJ2195 旅行
  5. hadoop emr_在Amazon EMR上运行Hadoop MapReduce作业
  6. python主循环方法mainloop_python gobject.mainloop吞噬信号事件
  7. python网络爬虫基础day01
  8. 如何嫁给改变世界的男人:程序员理想女友大调查
  9. vb 关于commondialog的多选
  10. win10远程控制ubuntu16.04
  11. 基于php工程项目管理系统——计算机毕业设计
  12. 考研复习时间安排初试篇
  13. msgbox窗口学习总结窗体复合框
  14. Visual Studio Codec#
  15. 依赖倒转原则和里氏代换原则详解
  16. 日期解析:2021-05-15T23:30:00+08:00
  17. 图结构解决农夫过河问题(二附源代码)
  18. ParameterizedType类型设置默认值
  19. python 正则表达式 re 爬取网页及分析总结
  20. winfrom 操作Excel

热门文章

  1. 【总结帖】九日集训,乾坤未定,未来可期0.0
  2. libevent 编译
  3. 人生的十字路口,我该何去何从?
  4. CentOS 7 压缩包安装MySQL(教程+一键完成脚本)
  5. 淘宝店铺装修之 1920自定义区域
  6. 256色灰度图哈夫曼编码压缩
  7. 【WINDOWS / DOS 批处理】批处理文件的参数 、标签的参数
  8. 格创东智入榜“2021粤港澳大湾区新经济先锋企业50强”
  9. 聚焦智能制造趋势,世界智能大会智能制造高峰论坛干货分享
  10. matlab一计算自动四舍五入6,《MATLAB程序设计》复习题