python数据批量写入ScrolledText的优化方法

 更新时间:2018年10月11日 10:15:29   作者:up1012  
今天小编就为大家分享一篇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)

效率提升了百倍!

以上这篇python数据批量写入ScrolledText的优化方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:

相关文章

最新评论