The first week of Python automation development and learning, and the first week of python Automation
1. Development History of python
2. What language is python?
Compiled or interpreted? Python is an interpreted language.
Advantages of python: easy to understand, high development efficiency, advanced language, portability, scalability, and embedability
Disadvantages: slow speed, Code cannot be encrypted, and threads cannot use multiple CPUs
3. Install python
Install Python 2 and Python 3 in Windows:
Http://edu.51cto.com/course/course_id-6823.ht
Python in linux
4. compiled the first python program.
#! /Usr/bin/env python
Print ("hello, world ")
5. Install pycharm
6. learned the variables.
Variable definition rules
Variable names can only be any combination of letters, numbers, or underscores
The first character of the variable name cannot be a number.
Other keywords cannot be declared as variable names.
['And', 'as', 'assert ', 'Break', 'class', 'contine', 'def', 'del ', 'elif ', 'else', 'Got t', 'exec ', 'Finally', 'for ', 'from', 'global', 'if', 'import', 'in ', 'Is ', 'lambda', 'not ',' or ', 'pass', 'print', 'raise ', 'Return', 'try', 'while ', 'with', 'yield ']
Constants are in uppercase.
Character encoding: ASCII ---- unicode --- uft-8
7.
Note
Single Row #
Use three quotation marks for multiple rows """"""''''''
User input
Name = input ("name :")
Age = input ("age :")
Job = input ("job :")
Salary = input ("salary :")
Info = '''
----------- Info of % s -----------
Name: % s
Age: % s
Job: % s
Salary: % s
''' % (Name, name, age, job, salary)
Info2 = '''
----------- Info of {name }-----------
Name: {name}
Age: {age}
Job: {job}
Salary: {salary}
'''. Format (name = name, age = age, job = job, salary = salary)
Info3 = """
----------- Info of {0 }-----------
Name: {0}
Age: {1}
Job: {2}
Salary: {3}
". Format (name, age, job, salary)
Print (info3)