In this section, you will get familiar with the development environment which has been used throughout this tutorial series to run python code. It's probably the best environment to write and execute the python code while learning. Moreover, there is no extra installation required since it comes bundled with Python's compiler. So, if you have followed the installation steps as given in the last tutorial, you might already be having IDLE in your system.
在本部分中,您将熟悉本教程系列中用于运行python代码的开发环境。 学习时可能是编写和执行python代码的最佳环境。 此外,由于它与Python的编译器捆绑在一起,因此不需要额外的安装。 因此,如果您按照上一教程中给出的安装步骤进行操作,则您的系统中可能已经有IDLE。
It's time to open IDLE now, you can do it by typing IDLE in Windows/Mac/Linux search bar and it should appear.
现在该打开IDLE了,您可以通过在Windows / Mac / Linux搜索栏中键入IDLE来完成,它应该会出现。
![Introduction to IDLE](https://i-blog.csdnimg.cn/blog_migrate/cdf2c572d7f3c97a110158af94ca4fa7.png)
This is pretty much how it looks. You can see the cursor blinking right after >>>
. This is where you will be writing your code. Also, the current running version of Python is also mentioned at the top.
这看起来差不多。 您可以在>>>
之后看到光标闪烁。 这是您编写代码的地方。 另外,顶部还提到了当前运行的Python版本。
![Introduction to IDLE](https://i-blog.csdnimg.cn/blog_migrate/557535a8a1b0ff505dc8b5f038c5f258.png)
In IDLE we write code line by line. One line will handle one thing. You type whatever you want in that line and press enter to execute it. IDLE works more like a terminal or command prompt - You write one line, press enter, it executes.
在IDLE中,我们逐行编写代码。 一行可以处理一件事。 您在该行中键入所需的任何内容,然后按Enter键以执行它。 IDLE的工作方式更像终端或命令提示符-您编写一行,按Enter,它就会执行。
We can also create python file which will contain the complete multiline program and can execute that using IDLE as well. A python script has an extension .py
.
我们还可以创建python文件,该文件将包含完整的多行程序,并且也可以使用IDLE执行该文件。 python脚本的扩展名为.py
。
Python takes some time to compile, its compilation is not fast, thus writing the example code in a file, then compiling the whole code again and again gets tedious and is not suited for beginners. When we open the IDLE, a session is created, which saves all the lines of code that you write and execute in that one window as a single program. This is the reason why, what you wrote above may affect what you will write later, eg. using a variable. Here is a preview of how we will be typing in IDLE.
Python需要花费一些时间进行编译,其编译速度并不快,因此将示例代码写入文件中,然后一次又一次地编译整个代码变得乏味且不适合初学者。 当我们打开IDLE时,将创建一个会话,该会话将您在该窗口中编写和执行的所有代码行保存为单个程序。 这就是为什么您上面编写的内容可能会影响您以后编写的内容的原因,例如。 使用变量。 这是我们将如何输入IDLE的预览。
![Introduction to IDLE](https://i-blog.csdnimg.cn/blog_migrate/93ac53e48bca6ff4195a4f21e00d3493.png)
IDLE is pretty neat in its own way. You can choose custom colours for the background and text, to give it your own style. There is an auto-complete feature, which predicts what you are typing and suggests it (pretty much like Google search).
IDLE以其自己的方式非常简洁。 您可以为背景和文本选择自定义颜色,以赋予自己的风格。 有一项自动完成功能 ,可以预测您要输入的内容并提出建议(非常类似于Google搜索)。
![Introduction to IDLE](https://i-blog.csdnimg.cn/blog_migrate/a3db2c1e59b5911b8799b9a328143216.png)
Above all, it is available for all major operating systems!
最重要的是,它可用于所有主要操作系统!
翻译自: https://www.studytonight.com/python/introduction-to-idle