import time
import pandas as pd
import openpyxl
import openpyxl.cell._writer
import os
from tkinter.filedialog import *
from tqdm import *
# input('請在此處回車開始執行程式')
# print('需要轉化為Excel格式的txt/rtz型別檔案')
# files = askopenfilenames(title= '請選擇需要轉化的txt/rtz檔案')
# for i in files:
# 根據是否存在借貸按照右側基準補齊
def debt_credit(list_input: list, length: int):
if ('借' in list_input) | ('貸' in list_input):
while len(list_input) < length:
list_input.insert(0, '')
return list_input
# 去除空格後補長度
def remove_space(list_input, length)
# 轉換主程式
def transfer(file):
# 測算最長行
max_line = max([len(i) for i in open(file, 'r')])
print(max_line)
# 進行迴圈
with open(file, 'r') as f:
for index, line in tqdm(enumerate(f), total=sum([1 for i in open(file, 'r')])):
content = line.split()
# transfer(r"D:\Desktop\新建資料夾\新建資料夾\待抵扣初處理 - 副本 (4).txt")
print(debt_credit(['借', 1, 1, 1], 5))