I. directory
1. Introduction to Python
The founder of python, Guido van Rossum, is now a particularly frequent development language.
Main application areas:
- Cloud Computing: The hottest language in cloud computing. Typical applications are OpenStack.
- WEB Development: Many excellent WEB frameworks, many large websites are Python development, such as: Youtube, Dropbox, BT, Quora (China Knows), Douban, Knows, Google, Yahoo!, Facebook, NASA, Baidu, Tencent, Car House, Art Troupe, etc. Typical WEB frameworks are Django.
- Scientific computing and artificial intelligence: typical libraries NumPy, SciPy, Matplotlib, Enthought libraries, pandas
- System Operations and Maintenance: Operations and Maintenance Personnel Must Return to Language
- Finance: Quantitative trading, financial analysis, in the field of financial engineering, Python is not only used, but also used the most, and its importance is increasing year by year. Reason: Python, as a dynamic language, has clear and simple language structure, rich library, mature and stable, scientific calculation and statistical analysis are very powerful, and its production efficiency is far higher than that of c,c++,java, especially good at strategy retrospective testing.
- Graphic GUI: PyQT, WxPython,TkInter
What can we do after learning?
- Python Development Engineer: Generally need to be proficient in Python programming language, have experience in using Django and other frameworks, no internship requirements.
- Python Senior Engineer: If you want to go north, you need to be proficient in Linux/Unix platform and have English reading skills.
- Web site development direction: familiar with the common Python framework of Web development, familiar with the operation of Mysql class database.
- SEO Engineer: Develop and improve SEO related software for oneself or company to achieve automated search engine optimization and daily repetitive work.
- Python Automated Testing: Familiar with automated processes, methods and the use of commonly used modules, have the ability to read and write in English.
- Linux Operations and Maintenance Engineer: Linux server management, data analysis, automated processing tasks, analysis of website logs, timing plan management, free hands.
- Python Game Development Engineer: Logic development and processing of the back-end server of online games, experience in using large databases, like to work in game-related work.
- Python self-study enthusiasts: you can develop some small software and applications, with graphical interface software, to facilitate daily work.
2.Python History
slightly
3.Python 2 or 3?
Although 2 and 3 are somewhat different, they must be used more and more with the passage of time, so we should learn 3 well.
4. Installation of Python
windows downloads programs directly for installation. Linux and Apple default to python. If you need a new version, you need to download and install it.
All my exercise notes were completed in Pycharm 5.0.3, and the python version was 3.6.
5. Write the first Hello World program
6. Variable/character encoding
a. Variables are variable. The definition rules of variables in python are as follows:
- Variable names can only be any combination of letters, numbers, or underscores
- The first character of a variable name cannot be a number
- The following keywords cannot be declared as variable names ['and','as','assert','break','class','continue','def','del','elif','else','except','exec','last','for','from','global','if','import','in','is','lambda','not','or','pass','print','return','try','while']
b. A brief history of character encoding:
USA: 1963 ASCII (127 characters, 1 byte)
China: 1980 GB2312 (7445 Chinese characters, including 6763 Chinese characters and 682 other symbols)
1993 GB13000 (containing 20902 Chinese characters)
1995 GBK 1.0 (21003 Chinese characters)
2000 GB18030 (containing 70244 Chinese characters)
World: 1991 unicode ('Universal Code'is also a unified code, usually 2 bytes, 4 bytes for complex Chinese characters)
UTF-8 (Variable Length Character Coding)
The character encoding conversion process of the string in Python 2 is as follows:
Byte string - > decode ('original character encoding') - - > Unicode string - > encode ('new character encoding') - - > byte string
The string defined in Python 3 is unicode by default, so it does not need to be decoded first and can be directly encoded into a new character encoding:
String - > encode ('new character encoding') - - > byte string
7. User input
That is, interactive reminders require users to enter some information, and then print the corresponding results.
8. module
The power of Python is that it has a very rich and powerful standard library and third-party library, almost any function you want to achieve has the corresponding Python library support.
9. What is PyC
We say that pyc files are actually a way of persistent preservation of PyCodeObject
10. Initial Knowledge of Data Types
- Numbers: Shaping, Floating Point, Complex
- Boolean: 1 (True) is true, 0 (False) is false
- Character string:
- List: Index, Slice, Added, Deleted, Length, Circulation, Containment
- Tuples: variable lists
- Dictionary: Disorder
- Bytes: bytes
11. Data Operation
- Arithmetic operations (+ (addition), -(subtraction), * (multiplication), /(division), (modulus), ** (power), //(division))
- Comparisons (== (equal),! = (not equal), <> (not equal), > (greater), < (less than), >=(), <=())
- Assignment operations (=, += (self-increasing), -= (self-decreasing), *= (self-multiplying),%= (self-modulus), **=(), //=())
- Logical operations (and, or, not)
- Membership operations (in, not in)
- Identity operations (is, is not (is the same object)?
- Ternary operation (result = value 1 if condition else value 2 (if condition is true result = value 1, if condition is false result = value 2))
Learn more about: Slamming here
12. The expression if... Else statement
13. Expressions for and wile loops
14.break and cotinue
2. Exercise
1. slightly 2. slightly 3. slightly 4. slightly
5. Write our first hello world program
In linux: a. Create a new hello_world.py file
b. Edit the file # vim hello_world.py (add #!/ usr/bin/env python to the header of the file, specify the interpreter, and add a line'pring'Hello world')
b. Add executable permissions to the file # chmod a+x hello_world.py to execute through # python hello_world.py
Note, all my exercises were done in Pycharm.
Hello_world code#pycharm 5.0.3(python3.6) print('hello world!')