实现读取、赋值、清空这3个操作
# 1、获取表格的信息
# 使用第3方的库 openpyxl 读写 Excel 文件,默认可读写,若有需要可以指定write_only和read_only为True
from openpyxl import load_workbook
#连接到需要操作的 Excel 表格
wb = load_workbook(r'D:\test4444.xlsx')
# 获取自己需要的工作表 Sheet4
sheet1 = wb.get_sheet_by_name("Sheet4")
print(sheet1.nrows, sheet1.ncols) # 获取行和列
# 2、得到单元格A2的值
buff = sheet1['A2'].value # 第1种方法得到值
buff = sheet1.cell(row=2, column=1).value # 第2种方法得到值
print(buff)
# 3、把A2单元格的值赋值到A3单元格
sheet1.cell(row=3, column=1, value=buff) # 第1种赋值的方法
sheet1['A3'] = buff # 第2种赋值的方法
sheet1['A3'] = sheet1['A2'].value # 第3种赋值的方法
# 4、清空单元格A2单元格
sheet1['A2']="" # 第1种清空值的方法
sheet1.cell(row=2, column=1, value="") # 第2种清空值的方法
# 5、保存文件夹
wb.save(r'D:\test4444.xlsx')
import pandas as pd
pdData = pd.read_excel(r'D:\test4444.xlsx')
pdData.reset_index(inplace=True, drop=True) # 索引的重新排序
pdData = pdData.drop(0, axis=0) # 删除第1行
del pdData['字段1'] # 删除字段1的列
https://blog.csdn.net/qq_35328369/article/details/81588708?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control
https://blog.csdn.net/qq_33015657/article/details/108123688
https://blog.csdn.net/heavenmark/article/details/73518853
https://blog.csdn.net/u013250071/article/details/81911434
https://www.jianshu.com/p/f2c9dff344c6
https://blog.csdn.net/weixin_39624360/article/details/110681756
import datetime
dateTime_p = datetime.datetime.now() # datetime.datetime(2021, 6, 28, 17, 59, 55, 348990)
date_p = dateTime_p.date() # datetime.date(2021, 6, 28)
# 字符串转换为datetime
str_p = str(date_p) # '2021-06-28'
dateTime_p = datetime.datetime.strptime(str_p,'%Y-%m-%d') # datetime.datetime(2021, 6, 28, 0, 0)
str_p = '2021-06-28 15:29:08'
dateTime_p = datetime.datetime.strptime(str_p,'%Y-%m-%d %H:%M:%S') # datetime.datetime(2021, 6, 28, 15, 29, 8)
import datetime
dateTime_p = datetime.datetime.now() # datetime.datetime(2021, 6, 28, 17, 59, 55, 348990)
# datetime转换为字符串
str_p = datetime.datetime.strftime(dateTime_p,'%Y-%m-%d') # '2021-06-28'
str_p = datetime.datetime.strftime(dateTime_p,'%Y-%m-%d %H:%M:%S') # '2021-06-28 15:29:08'
import datetime
last_date = (datetime.datetime.today()+datetime.timedelta(days=-1))
# datetime.datetime(2021, 6, 27, 18, 8, 3, 437741)
https://www.cnblogs.com/onemorepoint/p/8425300.html
https://zhuanlan.zhihu.com/p/101677743
output4 = pd.pivot_table(output4, index=['行'], columns=["列"], values=['总计'], fill_value=0, aggfunc=np.sum, margins=True)
# aggfunc=[len,np.sum,np.mean]::对该列元素进行计数(len)或求和(np.sum)或求均值(np.mean),
# margins=True::总计的值(All)
output4.columns = ['行标签','S4','S44','S444','S4444','总计']
output4['行标签'] = output4['行标签'].astype('category')
output4['行标签'].cat.reorder_categories(['幸','运','数','字','是','4'], inplace=True)
output4.sort_values('行标签', inplace=True)
https://blog.csdn.net/weixin_44266650/article/details/106920655
https://xercis.blog.csdn.net/article/details/105380586?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control
import pandas as pd
writer = pd.ExcelWriter('test4444.xlsx')
data1.to_excel(writer,sheet_name='sheet1')
data2.to_excel(writer,sheet_name='sheet2')
writer.save()
import calendar
monthRange = calendar.monthrange(2016,9)
print(monthRange) # (3, 30)# 输出的是一个元组,第一个元素是所查月份的第一天对应的是星期几(0-6),第二个元素是这个月的天数。以上实例输出的意思为 2016 年 9 月份的第一天是星期四,该月总共有 30 天。
https://www.runoob.com/python/python-email.html
https://zhuanlan.zhihu.com/p/20800785
https://jingyan.baidu.com/article/425e69e69690f0be15fc168a.html
https://www.w3school.com.cn/tiy/t.asp?f=html_comment
def exec_code():
LOC = """
def factorial(num):
fact=1
for i in range(1,num+1):
fact = fact*i
return fact
print(factorial(5))
"""
exec(LOC)
exec_code()
https://www.runoob.com/python3/python-execute-string-code.html
format(1234567890,',') # '1,234,567,890'
https://www.cnblogs.com/linxiyue/p/4183230.html
https://blog.csdn.net/BabyFish13/article/details/80223038
import win32com.client
xls = win32com.client.Dispatch("Excel.Application")
xls.Workbooks.Open("宏代码所在excel全路径")
xls.Application.Run("宏名称")
xls.Application.Quit()
https://blog.csdn.net/zyq_victory/article/details/82960807
,encoding='UTF-8’或者,encoding=‘gbk’
pd.read_csv(filename,error_bad_lines=False)
,sep=’/t’ # 制表符“/t”
https://jingyan.baidu.com/article/d621e8dac5c0da6865913fa5.html
import datetime
def week_num(start_time, end_time):
week_start = datetime.datetime.strptime(start_time, '%Y-%m-%d')
week_end = datetime.datetime.strptime(end_time, '%Y-%m-%d')
# # 方法1:
# return week_end.isocalendar()[1] - week_start.isocalendar()[1]
# 方法2:
return int(datetime.datetime.strftime(week_end, "%W")) - int(datetime.datetime.strftime(week_start, "%W"))
print(week_num("2020-04-14", "2020-04-24")) # output:1
1、查看当前chrome版本
chrome://version/
2、Selenium Chrome版本与chromedriver兼容版本对照表
https://blog.csdn.net/qq_40024178/article/details/90520044
3、Message: unknown error: Chrome failed to start: crashed问题解决方法
https://blog.csdn.net/m0_37772930/article/details/105276343
4、selenium之find_element_by_xpath定位元素
https://www.cnblogs.com/aaronthon/p/12739437.html
https://www.cnblogs.com/yuer20180726/p/10789426.html
5、selenium的三种等待https://www.cnblogs.com/mousecode/p/12700081.html
https://www.cnblogs.com/qianjin100/p/9910699.html
6、selenium 反爬虫之跳过淘宝滑块验证(2020/8)(转载)
https://blog.csdn.net/kikkc/article/details/108003595
https://www.cnblogs.com/gopythoner/p/7735379.html
7、使用selenium爬取天猫商品
https://blog.csdn.net/qq_44907926/article/details/113790090
8、[selenium]被识别如何解决?爬虫上线的selenium如何配置
https://blog.csdn.net/kzl_knight/article/details/106613495
9、
https://www.cnblogs.com/zhao1949/p/11375755.html