Python 的 IDLE 与其命令行的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32497691/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference Between Python's IDLE and its command line
提问by Donatas
What are the key differences between Python's IDLE and its command line environment? IDLE looks nicer, of course, and has some kind of GUI...
Python 的 IDLE 与其命令行环境之间的主要区别是什么?IDLE 看起来更好看,当然,还有某种 GUI ......
Moreover, is IDLE treated the same as the shell? I mean, the shell is the middle layer between the user and Python's interpreter?
此外,IDLE 是否和 shell 一样对待?我的意思是,shell 是用户和 Python 解释器之间的中间层?
Thanks
谢谢
采纳答案by ChristosS
They are both the same thing but, IDLE is made to write python code so its better if you can to write on IDLE. You can also try Notepad++ its a pretty good program to write code on.
它们都是一样的东西,但是,IDLE 是用来编写 python 代码的,所以如果你可以在 IDLE 上编写它会更好。您也可以尝试 Notepad++,它是一个非常好的编写代码的程序。
回答by user2622016
IDLE is a very simple Integrated Development Environment. It runs the same python, libraries etc. as commant-line.
IDLE 是一个非常简单的集成开发环境。它运行与命令行相同的 python、库等。
Even more basic (with less features) is IPython. Full feature IDE for Python is, for example, Eclipse with PyDev plugin, or LiClipse.
更基本的(功能较少)是 IPython。例如,Python 的全功能 IDE 是带有 PyDev 插件的 Eclipse 或LiClipse。
回答by Terry Jan Reedy
I am not sure what you question is, but here is a Windows-7 oriented answer of similarity and difference. In the start menu for Python x.y, you can select 'Python x.y (x bits)' to run python interactive in a text-line-oriented console window provided by Microsoft. The console handles key presses and mouse movements and clicks. When you hit , the console sends the line of text to python, which is waiting for input on sys.stdin. When Python processes the line, it sends output to sys.stdout or sys.stderr. This includes '>>> ' and '... ' prompts. The console displays the text for you to see.
我不确定您的问题是什么,但这里有一个面向 Windows-7 的相似性和差异性答案。在 Python xy 的开始菜单中,您可以选择“Python xy(x 位)”以在 Microsoft 提供的面向文本行的控制台窗口中运行 python 交互。控制台处理按键、鼠标移动和点击。当您点击 时,控制台将文本行发送到 python,它正在等待 sys.stdin 上的输入。当 Python 处理该行时,它会将输出发送到 sys.stdout 或 sys.stderr。这包括“>>>”和“...”提示。控制台显示文本供您查看。
In the start menu, you can instead select 'Idle ...'. Unless you have previously selected a different startup option, python run Idle code which uses the tkinter module which used tcl/tk to run a graphical user interface that somewhat imitates the console. The tkinter/tk gui handles key and mouse input and displays output. In both cases, some software besides the Python interpreter itself handles interaction between you and Python.
在开始菜单中,您可以改为选择“空闲...”。除非您之前选择了不同的启动选项,否则 python 运行空闲代码,该代码使用 tkinter 模块,该模块使用 tcl/tk 来运行在某种程度上模仿控制台的图形用户界面。tkinter/tk gui 处理按键和鼠标输入并显示输出。在这两种情况下,除了 Python 解释器本身之外,还有一些软件会处理您和 Python 之间的交互。
Some important differences:
一些重要的区别:
Cut, copy, and paste work normally. The Windows console is crippled in this respect.
Idle colors input and output. The Windows console does not.
Idle can display all unicode BMP (the first 64K) chars. The Windows console is limited by code pages.
剪切、复制和粘贴工作正常。Windows 控制台在这方面是残缺的。
空闲颜色输入和输出。Windows 控制台没有。
空闲可以显示所有 unicode BMP(前 64K)字符。Windows 控制台受代码页的限制。
For 1, 2, and 3, the console of other OSes may do as well or better than Idle.
对于 1、2 和 3,其他操作系统的控制台可能与 Idle 一样好或更好。
- Idle lets you enter, edit, send, and retrieve complete statements. Interactive python with Windows console only works with physical lines.
- Idle 允许您输入、编辑、发送和检索完整的语句。带有 Windows 控制台的交互式 python 仅适用于物理线。
Update, 2017/11:
2017/11 更新:
Item 1 above: At least on current Win10, cut, copy, and paste work normally.
上面第1条:至少在当前的Win10上,剪切、复制和粘贴工作正常。
Item 3 above: At least on Win10, unicode works better in Command Prompt with 3.6+.
上面的第 3 项:至少在 Win10 上,unicode 在 3.6+ 的命令提示符中运行得更好。
New item 5: The IDLE doc section, also available as Help => IDLE Help
now has section '3.3. IDLE-console differences'.
新项目 5:IDLE 文档部分,Help => IDLE Help
现在也可以使用“3.3”部分。空闲控制台差异'。
回答by Emma Joyce
Python IDLE is where you write your program/s and Python Shell is where you run your program/s. I hope this helps you.
Python IDLE 是您编写程序的地方,而 Python Shell 是您运行程序的地方。我希望这可以帮助你。