Python Learning In Debian Linux-getting started

Source: Internet
Author: User

Python is a simple, easy-to-learn, powerful, and easy-to-maintain scripting language.

Python includes: String, variable, identifier, data type, object, operator and expression, control flow, function, module.

Python considerations:

1.In pythonIndent(Space and Tab) is used to determine the indentation level of the logical line and determine the grouping of statements. Statements at the same level must have the same indentation. Incorrect indentation may cause errors.

For example, create the test. py file in the Linux Command window, for example,

Write two lines of code in test. py, with different indentation. For example, save and exit (: WQ !)

Enter Python test. py in the Linux Command window and press Enter. For example, an error is returned because the indentation of the second line of code is different from that of the first line.

2. Python Comments start with #, for example #! The comments started in this form are called organizational lines, used to tell which interpreter should be run on the Linux/Unix system in use


When #! is added to the top of the python file #! /Usr/bin/Python organize rows. You can run Python files in the following ways.

The chmod command is used to changeFile mode. To permit all users in the system to execute the source file, you can run the program by specifying the location of the source file .. /Indicates that the program is located in the current directory.

Even if we change the file nametestAnd then run./Test. This program can still work because the system knows that it must run the program using the interpreter specified in the first line of the source file.

3.Get help from a python function or statement through help ()

For example

Press Q to exit the help

 

 

 

Related Article

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.