current position：Home>Notes on python (I): getting to know Python
Notes on python (I): getting to know Python
2022-01-30 10:44:05 【A bowl week】
Little knowledge , Great challenge ！ This article is participating in “ A programmer must have a little knowledge ” Creative activities .
Hello everyone , I am a A bowl week , One doesn't want to be drunk ( Internal volume ) The front end of the . If you are lucky enough to get your favor , I'm very lucky ~
Python brief introduction
Python The history of
- 1989 Christmas ：Guido von Rossum Start writing Python Compiler of language .
- 1991 year 2 month ： first Python compiler （ It's also an interpreter ） Be born , It is to use C The realization of language （ Back ）, You can call C Library functions of a language . In the earliest version ,Python Has been provided for “ class ”,“ function ”,“ exception handling ” And so on , And the list 、 Dictionary and other core data types , At the same time, it supports building applications based on modules .
- 1994 year 1 month ：Python 1.0 Official release .
- 2000 year 10 month 16 Japan ：Python 2.0 Release , Added full Garbage collection , Provide for the right to Unicode Support for . meanwhile ,Python The whole development process is more transparent , The impact of the community on the development schedule is growing , The ecosystem began to take shape .
- 2008 year 12 month 3 Japan ：Python 3.0 Release , It is not fully compatible with previous Python Code , But at present, there are many companies using it in projects and operation and maintenance Python 2.x edition , therefore Python 3.x Many of the new features were later ported to Python 2.6/2.7 In the version .
Currently we use Python 3.7.x The version of 2018 Published in ,Python Version number of is divided into three sections , Form like A.B.C. among A Indicates large version number , Generally when the whole is rewritten , Or when there is a change that is not backward compatible , increase A;B Indicates function update , Add when new features appear B;C Represents a small change （ for example ： Fixed a Bug）, Add as long as there are changes C. If the Python Interested in the history of , You can read the 《Python Brief history 》 Internet articles .
Python Advantages and disadvantages
Python Many advantages , It can be summarized as follows .
- Simple and clear , Low learning curve , Easier to use than many programming languages .
- Open source , With a strong community and ecosystem , Especially in the field of data analysis and machine learning .
- Explanatory language , Born with platform portability , Code can work on different operating systems .
- Two mainstream programming paradigms （ Object oriented programming and functional programming ） All supported .
- High level of code specification , High readability , It's suitable for people with code cleanliness and obsessive-compulsive disorder .
Python The main shortcomings of this paper are as follows .
- Less efficient execution , The parts requiring high execution efficiency can be written in other languages （ Such as ：C、C++） To write .
- The code can't be encrypted , But now many companies do not sell software but services , This problem will be weakened .
- At development time There are too many frames to choose from （ Such as Web The framework has 100 Multiple ）, Where there is a choice, there is a mistake .
Python Application fields of
at present Python stay Web Application backend development 、 Cloud infrastructure construction 、DevOps、 Network data collection （ Reptiles ）、 automated testing 、 Data analysis 、 Machine learning and other fields have a wide range of applications .
install Python Interpreter
install Python The interpreter is relatively simple , There's no demo here
function Python Program
testing Python Is the installation complete
stay Windows In the command line of the, type the following command ：
python --version # Python 3.10.0 Copy code
Of course, you can type
python3 Enter the interactive environment , Then perform the following code check Python Version of .
python # Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32 # Type "help", "copyright", "credits" or "license" for more information. # >>> import sys # >>> print(sys.version) # 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] # >>> exit() Copy code
To write Python Source code
You can use text editing tools （ Recommended Sublime、Visual Studio Code And other advanced text editing tools ） To write Python Source code and
py Save the file as a suffix , The code content is as follows ：
print('hello, world!') Copy code
Run the program
Switch to the directory where the source code is located and execute the following command , See if there is any output on the screen "hello, world!".
python hello.py Copy code
python3 hello.py Copy code
Annotation is an important part of programming language , It is used to interpret the function of the code in the source code to enhance the readability and maintainability of the program , Of course, you can also remove the code segments in the source code that do not need to participate in the operation through comments , This is often used when debugging programs . Comments are removed when they come into preprocessor or compilation with source code , It will not remain in the target code and will not affect the execution result of the program .
- Single-line comments ： With
#And the beginning of the space
- Multiline comment ： Three quotes at the beginning , Three quotes end
# Print hello world print('Hello World') ''' This is a multiline comment ''' Copy code
author[A bowl week],Please bring the original link to reprint, thank you.
The sidebar is recommended
- Python Network Programming -- create a simple UPD socket to realize mutual communication between two processes
- leetcode 110. Balanced Binary Tree（python）
- Django uses Django celery beat to dynamically add scheduled tasks
- The bear child said "you haven't seen Altman" and hurriedly studied it in Python. Unexpectedly
- Optimization iteration of nearest neighbor interpolation and bilinear interpolation algorithm for Python OpenCV image
- Bilinear interpolation algorithm for Python OpenCV image, the most detailed algorithm description in the whole network
- Use of Python partial()
- Python game development, pyGame module, python implementation of angry birds
- leetcode 1104. Path In Zigzag Labelled Binary Tree（python）
- Save time and effort. 10 lines of Python code automatically clean up duplicate files in the computer
guess what you like
Learn python, know more meat, and be a "meat expert" in the technical circle. One article is enough
[Python data structure series] "stack (sequential stack and chain stack)" -- Explanation of knowledge points + code implementation
Datetime module of Python time series
Python encrypts and decrypts des to solve the problem of inconsistency with Java results
Chapter 1: introduction to Python programming-4 Hello World
Summary of Python technical points
11.5K Star！ An open source Python static type checking Library
Chapter 2: Fundamentals of python-1 grammar
[Python daily homework] day4: write a function to count the number of occurrences of each number in the incoming list and return the corresponding dictionary.
Python uses turtle to express white
- Some people say Python does not support function overloading?
- "Python instance" was shocked and realized the dirty words and advertisement detection of the chat system with Python
- Introduction to Python - CONDA common commands
- Python actual combat | just "4 steps" to get started with web crawler (with benefits)
- Don't know what to eat every day? Python to tell you! Generate recipes and don't worry about what to eat every day!
- Are people who like drinking tea successful? I use Python to make a tea guide! Do you like it?
- I took 100g pictures offline overnight with Python just to prevent the website from disappearing
- Binary operation of Python OpenCV image re learning and image smoothing (convolution processing)
- Analysis of Python event mechanism
- Iterator of Python basic language
- Base64 encryption and decryption in Python
- Chapter 2: Fundamentals of python-2 variable
- Python garbage collection summary
- Python game development, pyGame module, python takes you to realize a magic tower game from scratch (1)
- Python draws a spinning windmill with turtle
- Deep understanding of Python features
- A website full of temptations for Python crawler writers, "lovely picture network", look at the name of this website
- Python opencv Canny edge detection knowledge supplement
- Complex learning of Python opencv Sobel operator, ScHARR operator and Laplacian operator
- Python: faker extension package
- Python code reading (Part 44): find the location of qualified elements
- Elegant implementation of Django model field encryption
- 40 Python entry applet
- Pandas comprehensive application
- Chapter 2: Fundamentals of python-3 character string
- Python pyplot draws a parallel histogram, and the x-axis value is displayed in the center of the two histograms
- [Python crawler] detailed explanation of selenium from introduction to actual combat 
- Curl to Python self use version
- Python visualization - 3D drawing solutions pyecharts, Matplotlib, openpyxl
- Use python, opencv's meanshift and CAMSHIFT algorithms to find and track objects in video
- Using python, opencv obtains and changes pixels, modifies image channels, and trims ROI
- [Python data collection] university ranking data collection
- [Python data collection] stock information collection
- Python game development, pyGame module, python takes you to realize a magic tower game from scratch (2)
- Python solves the problem of suspending execution after clicking the mouse in CMD window (fast editing mode is prohibited)
- [Python from introduction to mastery] (II) how to run Python? What are the good development tools (pycharm)
- Python type hints from introduction to practice
- Python notes (IX): basic operation of dictionary
- Python notes (8): basic operations of collections
- Python notes (VII): definition and use of tuples