What is the difference between Python IDLE (python GUI) and Python (comand line)

Source: Internet
Author: User

It took a few days for the command line to know the idle thing.

After opening Python 2.7 There are three command windows:IDLE (python GUI), Python (comand line), Module Docs.

Module Docs is a search box that can search for functions that are not known in Python.


Compare idle with command line: both interactive mode

IDLE (python GUI):

White window. There are code highlighting, auto indent, code hints and menu bar;

You can create a new Python file, copy and paste the code, but not return the results;

You cannot repeat the previous command with the UP arrow.

Python (comand line):

Black window, only after the execution of the error prompt.

No menu bar, only one line to type the command, paste a piece of code will be disassembled to a single command execution ;

Cannot paste the tab and space after for, will error.

Use the up arrow to reproduce the previous command faster.

Double-click the run file: To get rid of script mode and write code directly, first add the Python installation location to the environment variable path. You can then double-click to open the. py file. Workaround: add raw_input () or input () to the end of the. py file according to the version.

Two ways to run a. py file on the command line:

cmd: switch to the path where the file is located, execute: Python myname.py

Python.exe:

Import OS

Os.chdir (' current path ')//Switch to current path

OS.GETCWD ()//Get current path

Run: execfile (' myname.py ')

or Direct:execfile (entire path name + file name)

If you use import myname.py, you can only return execution results on the first import, and the import will error.


Copyright NOTICE: Welcome reprint, Reprint please indicate the source http://blog.csdn.net/ztf312/

What is the difference between Python IDLE (python GUI) and Python (comand line)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.