![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
笔记
python小白努力中
自信,美好,永不止步。
chinacheng2023
展开
-
selenium启动IE浏览器报错解决方式
1-下载对应版本的IEDriverServer.exe程序,放入"C:\Program Files\Internet Explore"文件夹下2-修改ie浏览器中Internet选项,如下图原创 2021-08-12 11:22:31 · 674 阅读 · 0 评论 -
python清空文件夹
import osimport shutildef RemoveDir(filepath):‘’’如果文件夹不存在就创建,如果文件存在就清空!'''if not os.path.exists(filepath): os.mkdir(filepath)else: shutil.rmtree(filepath) os.mkdir(filepath)原创 2021-07-31 15:20:50 · 1016 阅读 · 0 评论 -
selenium中隐式等待和显性等待区别
隐形等待是设置了一个最长等待时间,如果在规定时间内网页加载完成,则执行下一步,否则一直等到时间截止,然后执行下一步。注意这里有一个弊端,那就是程序会一直等待整个页面加载完成,也就是一般情况下你看到浏览器标签栏那个小圈不再转,才会执行下一步,但有时候页面想要的元素早就在加载完成了,但是因为个别js之类的东西特别慢,我仍得等到页面全部完成才能执行下一步,我想等我要的元素出来之后就下一步怎么办?有办法,这就要看selenium提供的另一种等待方式——显性等待wait了显性等待WebDriverWait,配合原创 2021-07-30 16:22:03 · 1101 阅读 · 0 评论 -
python时间块处理(季度第一天,季度最后一天,本月第一天,本月最后一天,本年第一天,本年最后一天,随机给日期获取想要结果)
"""通过datetime和dateutil进行常用日期的获取如:今年,去年,明年当前季度本月,上月,去年同期,今年一月今天,昨天,明天,本周、本月、本季度、本年第一天,本周、本月、本季度、本年最后一天""" import datetime # 获取常用特定日期(如去年/季度/当月/本周/首日/) # =======================================# 关于年(今年,去年,明年)# ==============================.原创 2021-05-11 16:09:21 · 2570 阅读 · 1 评论 -
实用pandas合并多个excel的多个sheet为一个文件
import pandas as pdimport ospath = r'C:\files' #指定文件夹路径wj_List = list(os.walk(path))[0][2] #所有子文件名xls_file = pd.ExcelFile(path+'\\'+wj_List[0])sheet_names = xls_file.sheet_names #获取excel文件的所有sheet名writer = pd.ExcelWriter(path+'\\'+'re原创 2021-05-08 15:30:34 · 820 阅读 · 0 评论 -
python 统计数据出现的频率
words_cnt = {}with open(‘test.txt’, ) as f:lines = f.readlines()for line in lines:line = line.replace(’,’, ’ ‘).lower() # 逗号都用英文状态的words = line.strip().split(’ ') # 括号里面的单引号里有空格for word in words:words_cnt[word] = words_cnt.get(word, 0) + 1words_l原创 2021-03-24 09:48:08 · 843 阅读 · 0 评论