Python:为什么IDLE比终端慢? [英] python: why IDLE is slower than terminal?

查看:300
本文介绍了Python:为什么IDLE比终端慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚编写了一个简单的python命令,以检查csv文件中的大列表。 csv有2列,每行10K。当我将第二行输入到列表中并随后打印该列表时,IDLE需要相当长的时间才能显示它在终端(在Mac下)迅速显示它的位置。 *顺便说一句,我在2台不同的机器上进行了检查-结果相同。

I just wrote a simple python command to check on a big list from a csv file. The csv has 2 columns with 10K lines. when I input the 2nd row into a list and later print the list, it takes the IDLE quite some time to show it where the terminal (under mac) shows it promptly. *BTW, I checked it on 2 different machines - same result.

很明显,没有人会在控制台上打印1万个项目,但是这个想法要比打印速度快得多另一个让我感到疑惑的是:为什么IDLE(应该是python最好的朋友)这么慢?

Obviously, no one will print 10k items on a console but the idea that one is significantly faster than the other makes me wonder: why IDLE which supposed to be python's best friend is so slow?

推荐答案

IDLE如何处理将文本打印到输出窗口;尝试注释掉 print 语句,看看性能差距是否仍然存在。请参阅与此密切相关的线程: Python:为什么IDLE这么慢?

The bulk of the problem is in how IDLE handles printing of text to the output window; try commenting out the print statement and see if the performance gap remains. See this closely related thread: Python: Why is IDLE so slow?

这篇关于Python:为什么IDLE比终端慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆