|
@@ -701,12 +701,20 @@ def open_file():
|
|
|
('excel files', '*.xlsx'),
|
|
|
('All files', '*.xlsx*')
|
|
|
)
|
|
|
-
|
|
|
+ # 指定文件路径
|
|
|
+ file_path = 'config/fileurl.txt' # 修改为你的文件路径
|
|
|
+ # 读取整个文件内容
|
|
|
+ with open(file_path, 'r', encoding='utf-8') as file:
|
|
|
+ content = file.read()
|
|
|
filename = filedialog.askopenfilename(
|
|
|
title='选择文件',
|
|
|
- initialdir='/',
|
|
|
+ initialdir=content, # D:/实验室/16、三普
|
|
|
filetypes=filetypes)
|
|
|
-
|
|
|
+ # 提取目录部分
|
|
|
+ directory_path = os.path.dirname(filename)
|
|
|
+ # 打开文件并写入内容
|
|
|
+ with open(file_path, 'w', encoding='utf-8') as file:
|
|
|
+ file.write(directory_path)
|
|
|
# 这里增加判断 若文件为空提示错误
|
|
|
simpleData = pd.read_excel(filename)
|
|
|
if not simpleData.empty:
|