python数据批量写入ScrolledText的优化

 
 
for i in data[::-1]:
    self.maintenance_text.insert(tk.END, str(i['payload']) + '\n\n')
    self.maintenance_text.see(tk.END)

改为:

str_data = '\n\n'.join([str(i) for i in data[::-1]])
self.maintenance_text.insert(tk.END, str_data)
self.maintenance_text.see(tk.END)
效率提升了百倍

猜你喜欢

转载自blog.csdn.net/up1012/article/details/79933628
今日推荐