Python WORK
England Mouse
这个作者很懒,什么都没留下…
展开
-
Python爬虫之收藏夹
正则表达式30分钟入门教程在线正则表达式测试requests中文文档Beautiful Soup 4.2.0 中文文档原创 2021-10-21 21:40:25 · 192 阅读 · 0 评论 -
Python爬虫之前期准备
1.Python的安装和配置略2.selenium2.1自动化测试工具2.2selenium现在不支持phantomjs,3.4.3支持2.3pip install selenium==3.4.33.driver3.1chromedriver–>chrome3.1.1chrome无头模式代码3.1.1.1参考自:python 常见跳坑之selenium框架不支持phantomjsfrom selenium import webdriverfrom selenium.webdri原创 2021-10-20 19:29:39 · 190 阅读 · 0 评论 -
Python WORK 03 -- 提取HTML中的图片URL
Python WORK 03 – 提取HTML中的图片URLdef main(): input_file = '0503.html' output_file = '0503.txt' html_lines = get_html_lines(input_file) image_urls = extract_image_urls(html_lines) show_results(image_urls) save_results(output_file, imag原创 2021-05-04 15:23:31 · 327 阅读 · 0 评论 -
Python WORK 01 -- guessthenum
Python EXERCISE 03 – guessthenumimport randomtarget=random.randint(1,1000)count=0while True: try: guess=eval(input('请输入一个猜测的整数(1至1000):')) except: print("输入有误,请重试,此次不计入次数。") continue count=count+1 if guess>tar原创 2021-04-22 00:19:21 · 90 阅读 · 0 评论 -
Python WORK 02 -- 文本词频统计
Python WORK 02 – 文本词频统计#CalHamlet.py#定义函数gettext,输入文本文件***.txt,得到lower和以空断词的一个文本字符串gettext()def gettext(): txt=open("thetext.txt","r").read() #text=open("***.txt","r").read() 等价于f=open("***.txt","r") text=f.read() txt=txt.lower() for ch原创 2021-05-02 18:13:26 · 138 阅读 · 0 评论