1、typescript_运行后生成相应的js脚本设置:
npm init -y命令生成package.json文件和npm install @types/node命令生成node-modules和package-lock.json文件
ctrl+c对js脚本管用,对ts脚本不管用;
疑问:虽然能ts脚本能运行不报错了,但是标红的怎么去除?——重启webstorm就好了
2、python的pandas多sheet页保存:
import pandas as pd import datetime import openpyxl import xlwings def save_to_several_sheet(read_path_name, sava_path_name): """软件版本去掉带有'-'符号后的字符串""" df = pd.read_excel(read_path_name, header=0, sheet_name="Sheet1") for i, row in df.iterrows(): print(f"编号{i}") if "-" in row["软件版本"]: df.loc[i, ["去掉横杠的软件版本"]] = row["软件版本"].split("-")[0] # 保存数据 # 1、一起保存为两个sheet页 with pd.ExcelWriter(sava_path_name) as writer1: df.to_excel(writer1, sheet_name='df1', index=False) df.to_excel(writer1, sheet_name='df2', index=False) # 2、df1和df2的后面再另取一个sheet页保存 book = openpyxl.load_workbook(sava_path_name) writer2 = pd.ExcelWriter(sava_path_name, engine='openpyxl') writer2.book = book # 转化为字典的形式 writer2.sheets= dict((ws.title, ws) for ws in book.worksheets) df.to_excel(writer2, sheet_name='df3', index=False) writer2.save() # 3、df1和df2的前面再另取一个sheet页保存: 没有列名 wb = xlwings.Book(sava_path_name) sht = wb.sheets.add(name='df4', before=None, after=None) # df.values() # 不然恵插入df的索引 sht.range("A1").value = df.values wb.save() wb.close() # 4、excel保存报错字符串保存超限制时用 now_time = datetime.datetime.now().strftime("%Y-%m-%d-%H-%S-%f") writer3 = pd.ExcelWriter(f"{sava_path_name}_{now_time}", engine='xlsxwriter', options={'strings_to_urls': False}) df.to_excel(writer3, sheet_name='df5', index=False, encoding="UTF-8") writer3.save()