1.1 Python Getting Started - Basic Concepts

1.1 compiled and interpreted languages
Compiled and interpreted, both have their advantages and disadvantages. The former due to the fast execution speed, with inferior conditions on the system requirements relatively low, and therefore, like the development of operating systems, large-scale applications, database systems have adopted it, like C / C ++, Pascal / Object Pascal (Delphi), VB , etc. basic can be seen as a compiled language , and some web scripts, server script and assist in developing such an interface speed of less demanding on the platform between different systems have certain requirements compatibility program is usually interpreted language , such as Java, JavaScript, VBScript, Perl, Python, and so on. 

1.2 Dynamic and static languages
usually what we call dynamic languages and static language is a dynamically typed language and a statically typed language.

(1) dynamically typed languages: dynamically typed language is the only language data type checking is done during operation, that is, when a dynamically typed programming language, will never need to specify the data type of any variable , the language will when you first assigned to variables, data types internally recorded. Python and Ruby is a typical dynamically typed languages, various other scripting languages such as VBScript also how many of dynamically typed languages.

(2) statically typed languages: statically typed language with dynamically typed languages just the opposite, it is checked at compile data types between them, that is to say when writing a program to declare the data types of all variables , C / C ++ is a statically typed language a typical representative of the other statically typed languages as well as C #, JAVA and so on.

 

1.3 strongly typed and weakly typed language definition language

(1) strongly typed language: mandatory data type definition language. That is, once a variable is assigned a data type, if not through coercion, then it will always be this type of data. For example: if you define an integer variable a, then the program will be impossible as a string type process. Strongly typed language is type-safe language.

(2) weakly typed definition language: data types of languages ​​can be ignored. Instead it strongly typed language, the value of a variable can be assigned different data types.

Strongly typed language in speed may be slightly inferior to the weak type definition language, but strongly typed language brings rigor can effectively avoid many mistakes. In addition, "the language is not a dynamic language" between "the language whether the type of security" is absolutely no connection!
For example: Python language is dynamic, is strongly typed languages (type-safe languages); VBScript language is dynamic, is weakly typed definition language (language unsafe type); the JAVA language is static, is strongly typed languages (type-safe language).

 

By the above description, we can draw, Python is a dynamic explanatory strongly typed language.

 

1.4 python installation

 

windows

1
2
3
4
5
6
7
1 、下载安装包
     https: / / www.python.org / downloads /
2 、安装
     默认安装路径:C:\python27
3 、配置环境变量
     【右键计算机】 - - 》【属性】 - - 》【高级系统设置】 - - 》【高级】 - - 》【环境变量】 - - 》【在第二个内容框中找到 变量名为Path 的一行,双击】  - - > 【Python安装目录追加到变值值中,用 ; 分割】
     如:原来的值;C:\python27,切记前面有分号

linux、Mac

1
2
3
无需安装,原装Python环境
 

 

 

 
 
Performed under linux, add the following to the file header (env environment variable to find representation in python):  
 
#!/usr/bin/env python
 
1.5 Variable

 

 

Declare variables

 
 
name = "Cici"

The code declares a variable called: name, variable name values: "Cici" 

Variables defined rules:

  • Variable names can be any combination of letters, numbers or underscore
  • The first character variable names can not be digital
  • The following keywords can not be declared variable name
    [ 'and', 'as' ,' assert ',' break ',' class', 'continue', 'def', 'del', 'elif', 'else', ' except ',' exec ',' finally ',' for ',' from ',' global ',' if ',' import ',' in ',' is', 'lambda', 'not', 'or' , 'pass', 'print' , 'raise', 'return', 'try', 'while', 'with', 'yield']

Constant General in capital

 

coding:

ASCII->GB2312->GBK1.0->GB18030->UNICODE->UTF-8

 

Guess you like

Origin www.cnblogs.com/cathyS/p/10955920.html