Python full stack _python base _day1

Source: Internet
Author: User

1.Python Introduction

Python is a programming language written by the famous "Uncle Turtle" Guido van Rossum during Christmas 1989 to send a boring Christmas.

Python is an interpreted language.

Interpreted language: The program is run by an interpreter, a read-only interpretation of the execution.

Python program execution process: source code =====>> bytecode file ======>> interpreter ======>> machine code.

Python is divided into 3.X and 2.X versions, and two versions are incompatible with each other.

2.Python Installation

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

To facilitate subsequent use, the installation path is best chosen c:python35

Set the environment variable when installing, or set it to the system after installation

3.Python Getting Started 3.1 file header

#!/usr/bin/env python    针对Linux系统,指定Python解释器

# -*- coding: utf-8 -*-   指定字符编码3.2 Comment Line comment For # Multiline comment for ' ' ' Comment content ' ' 3.3pyc file

When you execute Python code, if you import a different. py file, a. pyc file with the same name is automatically generated during execution, which is the bytecode generated after the Python interpreter was compiled.

PS: Code is compiled to generate bytecode, and bytecode can be obtained by decompile.

3.3 Variables

Consists of letters, numbers, and _, which cannot begin with a number, and cannot be used as a variable name.

Python-defined variables do not require a declaration type, variables that are not declared cannot be referenced directly

4. Input and output

Python2 input has raw_input (), parse all input into a string, enter a string with quotation marks, input () resolves to integer, float, string, etc. based on input content

Python3 input has only input (), all inputs parse to string, input string is not quoted

Python2 output print "Output content"

Python2 output print ("Output content")

5. Operators

+: Add

-: Minus

*: Multiply

/:python2 divisible, Python3 will not have a decimal

: Floor Except, (Do Python3)

%: Take remainder

* *: Power operation

= =: judging equality

! =: Not equal to

<: Less than

: Greater Than

<=: Less than or equal to

>=: greater than or equal to

Python full stack _python base _day1

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.