excel读写

安装库

1
2
pip install xlrd == 1.2.0
pip install openpyxl

xlrd好像有个版本的坑

1
2
3
4
5
6
7
8
9
import xlrd
def xlsx_parse():
yb = xlrd.open_workbook(r"E:\Py_code_save\1.xlsx")
sh = yb.sheet_by_name("Sheet")
data_list = []
for item in range(sh.nrows):
data = sh.row_values(item)
data_list.append(data)
return data_list

1
2
3
4
5
6
7
8
9
10
11
from openpyxl import Workbook
wb = Workbook()
ws = wb.active

def xlsx_save():
ws.append(["序号","标题","名称"])
for i in range(10):
ws.append([i])
wb.save("1.xlsx")


ffmpeg合并

生成批量txt

1
2
3
4
5
6
7
8
9
10
11
12
# _*_ coding:utf-8 _*_

import os

path = r'E:\save\Part_0'

file_list = os.listdir(path)
for item in file_list:
with open("E:\\save\\file.txt", "a+") as f:
hc_path = rf"file '{path}\{item}'"
f.write(str(hc_path) + '\n')
print("写入完成")

ffmpeg合成

1
ffmpeg -f concat -safe 0 -i file.txt -c copy -strict -2 111.mp4