我在python 3.6中有一个脚本,它解析Windows 7上的.csv文件。初始文件是一种生物分析器输出。我需要让它更具人性化,所以我根据初始文件中的数据添加注释。我使用词典来保留这些评论。该脚本还具有使用Tkinter库创建的GUI。
在我向dict_2添加一些额外的键之前,一切都运行良好。现在,无法再通过双击运行脚本。但是,如果我运行Thonny的脚本,它仍然有效。
有没有办法克服这个字典大小限制?
Python 3.6.3(v3.6.3:2c5fed8,2017年10月3日,17:26:49)[MSC v.1900 32位(英特尔)]在win32上
import sys
import subprocess
import os
import csv
from tkinter import *
from tkinter.messagebox import *
from tkinter.filedialog import *
def callback():
if askyesno('Verify', 'Close?'):
master.destroy()
else:
showinfo('No', 'Continue')
def make_report():
csv_filename = askopenfilename(initialdir = "/",title = "Chose file",filetypes = (("Report","*.csv"),("all files","*.*")))
txt_filename = asksaveasfilename(initialdir = "/",title = "resulting file*.txt",filetypes = (("txt","*.txt"),("all files","*.*")))
if (str(csv_filename)!= "" ) and str(txt_filename)!= "":
with open (str(csv_filename), 'r', newline='', encoding='utf-16') as tsvin:
tsvin = csv.reader (tsvin, delimiter=';')
with open (str(txt_filename) , 'w') as fileOut:
exlc_list = []
dict_1 = {'x1':'x1a', ...., 'x67':'x67a'}
dict_2 = {'y1':'x1a', ...., 'y216':'y216a'}
.....