Python Learning-baseno.1

Source: Internet
Author: User

First, Introduction:

Python: scripting language, interpreted language

Operation and maintenance of the necessary language, the application of the field is very broad, the future is broad.

Indentation is a very important point in Python syntax.

Python3 is the future development trend

Second, Python installation:

Windows:

1. Download the installation package:

https://www.python.org/downloads/

    默认安装路径:C:\python2.7

    3、配置环境变量

    【右键计算机】--》【属性】--》【高级系统设置】--》【高级】--》【环境变量】--》【在第二个内容框中找到 变量名为Path 的一行,双击】 --> 【Python安装目录追加到变值值中,用 ; 分割】

    如:原来的值;C:\python27,切记前面有分号

  linux & mac

    自带安装

三、第一个python程序

     print ("Hello World")

      Specify interpreter: If you want to execute a python script like executing a shell script, for example:   ./HELLO.PY 

    #!/usr/bin/env python

    1、Variable names can only be any combination of letters, numbers, or underscores

2. The first character of a variable name cannot be a number

3. Variable name cannot be a keyword

4, the variable name can not contain spaces and special characters (_ except)

Code:-*-coding:utf-8-*-

Five, module

Python has a rich and powerful library of standards and third-party libraries, which can be implemented in a non-language comparable capacity.

Import Sys

Print (Sys.path)


Import OS

Os.system ("df-th") #调用系统命令

Customizing the TAB Completion module

Import Sys

Import ReadLine

Import Rlcompleter

if sys.platform = = ' Darwin ' and sys.version_info[0] = = 2:

Readline.parse_and_bind ("Bind ^i Rl_complete")

Else

Readline.parse_and_bind ("Tab:complete") # Linux and Python3 on Mac

For Mac


This article is from the "LE" blog, please be sure to keep this source http://lz001.blog.51cto.com/8294567/1792820

Python Learning-baseno.1

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.