1. The first sentence of the Python statement
Print "Hello,world"
Execute file: Python hello.py
2. Variables
Note: variable names can only be any combination of letters, numbers, or underscores when defining variables, the first character of a variable name cannot be a number, and the Python keyword cannot be a variable.
2.1 Assignment of variables:
name1 = "Oldboy"
Print variable values
Print (NAME1)
3.python Interactive Input input
Name = input ("Please input name":)
Pring (name)
4. Number Types
I NT (integral type):
string:
In the definition of the value of the variable is quoted is a string, when the definition of the variable has multiple rows of values then we use the multi-quotes three quotation mark "" "to define
Boolean type:
Two values, a true (true), a false (false), mainly in mind to determine the logic
>>> a=3
>>> b=4
>>> a > 3
False
>>> a < 4
True
>>>
list type:
Definition, list nesting, Value column table values to use curly braces []
Test = [1,2,[4,5]]
Print (test[2][1])
List variable Increase append
Test.append ([5,6])
Dictionary type:
Only basic definition, value dictionary to use curly braces {}
dic={' name ': 2, ' name2 ': ' 3 '}
Print (dic[' name '])
dic[' name ']= ' body '
Print (DIC)
Day1 Python Primer