Week1-python Introductory Tutorial (later in the perfect)

Source: Internet
Author: User

One, Python is a kind of language:
Programming language Categories:
Compiled type:
Interpreted type: slow execution;

Dynamic Language: Checks the data type during run time without assigning data types to any variables;
Static language: Check the data type during compilation;

Strongly typed definition language: Enforces the language of data type definition, slower, more rigorous;
Weak type definition language: The data type can be ignored language, a variable can be assigned to different data types of values;

Python is a strongly-typed definition language with dynamic interpretation.


1. Advantages:
Simple, high development efficiency, has very powerful third-party library, high-level language, portability, extensibility, embeddable;
2. Disadvantages:
Slow, code can not be encrypted, the thread can not take advantage of multi-CPU (GIL);

Python interpreter: CPython IPython pypy Jython IronPython
. py File Execution:

Python2 or Python3:
Difference: Support Unicode,print ()

Ii. Getting started with Python:
1. The first Python program:
Print ("Hello world!")

#Linux上执行遇到问题: File format problem, use command Dos2unix helloworld.py conversion.

[Email protected] ~]#./helloworld.py
: No file or directory
#解决:
Open the Sh file with vim and enter:
: Set FF
Enter, display Fileformat=dos, reset the following file format:
: Set Ff=unix
Save exit

2. Variables and character encodings:
Variables: saving data, in order to invoke;
Define a rule: variable names can only be any combination of letters, numbers, or underscores, the first word Fu Bu is a number

Character encoding and binary:
The numbers are converted into binary;
The string is converted into binary;
ASCII: A maximum of 8 bits (one byte) can be represented in 8bit
English: GB2312, GBK (common), GB18030

Unicode (Uniform Code, universal Code, single code):

Comments:
Multiple lines: ' Here is the note '
Single line: # "" "

3. User interaction Program:
Name = Input ("username:") #一切输入都是字符str

Week1-python Introductory Tutorial (later in the perfect)

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.