Author:AXYZdong Automation Engineering Male A little bit of thinking , Have a little idea , A little bit rational ! Set a small goal , Try to be a habit ! Meet a better self in the most beautiful years ! More wonderful articles go to : Personal home page
Preface
I've heard of it for a long time Python name , The present Python It's very popular , As Xiaobai, I also want to taste fresh , After all, society is developing , We should also keep pace with the times !
This article applies to people like me Python The small white ,Python Please take a detour ,^ _ ^
One 、 First time to know Python
1、Python summary
1.1 Python The founder of
Guido · Van rosum (Guido van Rossum).1989 Christmas period of ,Guido Start writing to explain Python The interpreter of language grammar .Python The name , come from Guido Favorite TV series Monty Python’s Flying Circus. He wants this new one called Python Language , Can meet his ideal : Create a C and shell Between , Comprehensive function , Easy to learn and easy to use , Extensible language .
1.2 brief introduction
Python Is a cross platform computer programming language . It's a high-level combination of explanatory 、 Compilability 、 Interactive and object-oriented scripting language . Originally designed to write automated scripts (shell), With the continuous update of the version and the addition of new language features , The more it's used for independent 、 Development of large projects . in addition :Python Also widely used in Web Development , Big data processing , Artificial intelligence , Cloud computing , Automatic operation and maintenance development , Reptiles and Game development etc. .
2、Python Download and install
Python Download directly to the official website https://www.python.org After all, it's a foreign website , It's a little slow to get in at first , Just a minute . Of course, if you want to be faster , A ladder is also wide . Initiative : Healthy Internet access , Green Internet . Hey, hey, hey !!!
After entering the official website , Follow the steps below to download the installation package :1、 choice Download, Select... In the interface that appears Windows, Click in
2、 Select the type of installation package required , At present, most computer operating systems are 64 Bit , Just follow the operation in the figure . If the computer is 32 Bit , Just install the one below Download Windows x86 executable installer
3、 install , Be careful , Be careful , Be careful !!! Be sure to check... In the elliptical box below
otherwise ,cmd Enter python The contents in the red box below will not appear ( firsthand experience , It made me unload and reload ) The red box indicates python Installation is successful .
3、Python development tool
3.1 Use native IDLE
Python After installation , Will automatically generate a IDLE
Python Shell
Write code and run a new file , Try running a program ,《 Code Monkey 》
'''
@ function : Code Monkey
@ athuor:AXYZdong
@ ceate:2020-03-24,0:16
'''
print(" "*5+" Code Monkey ")
print(" "*15+"--《 Jiang zi 》 Adaptation \n")
print(" Ten years of life and death , Write program , Till dawn ")
print(" Thousand lines of code ,Bug Where to hide ")
print(" Even if it's online , Chaolingyi , Evening heartbroken ")
print(" Leading new ideas every day , Day by day , Busy day ")
print(" Care for words , Only a thousand tears ")
print(" Every night when the lights are dim , The programmer , Overtime crazie ")
The toolbar Click on Run Inside Run Module , Or press the shortcut key F5 function , Produce results :
3.2 Common third-party development tools
1.PyCharm2.Eclipse + PyDev3.Visual Studio + PTVS4.Ulipad5.Spyder6.Sublime Text
3.3 Shortcut key
Two 、Python Language foundation
Briefly, and C Something different
1、Python Coding specification and basic syntax in
(1) A semicolon : Don't add a semicolon to the line , Don't use semicolons to write two commands on the same line
(2) Line length : Generally, each line should not exceed 80 Characters
(3) Brackets : It's better to use brackets than to use them too much
(4) Indent : Use 4 Space to indent code
(5) Blank line : There are two empty lines between the top-level definitions , Empty a line between method definitions
(6) sentence : Each statement should be exclusive to one line
(7) Try to avoid spaces and Chinese characters in the file name
(8)python Its grammar is relatively simple , Indent , The code written is probably like this , among # The first sentence is a comment , Comments are for programmers , The interpreter ignores comments . Every other line is a statement , When the statement is : The colon ends with , Indented statements are code blocks
2、 data type
2.1 Boolean( Boolean value )
True Said really
trueFalse Said the false
false
2.2 list( list )
Python One of the built-in data types is list :list.list It's an orderly collection , You can add and remove elements at any time .
2.3 tuple( Tuples )
Another kind of ordered list is called tuple :tuple.tuple and list Very similar , however tuple Once initialized, it cannot be modified
2.4 dict( Dictionaries )
Python Built in dictionary :dict Support for ,dict Full name dictionary, Also known in other languages as map, Use the key - Value store , With extremely fast search speed .
2.5 set( aggregate )
set and dict similar , It's also a group. key Set , But don't store value. because key Can't repeat , therefore , stay set in , No repeat key.
3、 Logical operators
Python The basics of language are listed briefly , Just started learning , Learn more later !
summary
The text in the picture at the beginning of the article : Life is too short , I use Python !------- anonymous Python What big guys often say , We are Xiaobai , I don't know what it means ( If you know something, you can comment at the bottom of the article ), Hey !
There was... Before C The basis of ,Python Compared with C, There is nothing to discuss unsigned , short , long Once understood from Sequence / Mapping Look at the problem from the latitude , It's easy to distinguish list And dict Once you understand Imutable And mutable The meaning of , It's easy to guess tuple And list ,set And frozenset , Once you understand the different methods of list Of inplace-op And string Of non-inplace-op Realization , It's easy to guess how the method is used Python First experience : What a long long road! , I will go up and down !!!
This sharing is here
If my article helps you 、 If you like the content of my article , please “ give the thumbs-up ” “ Comment on ” “ Collection ” One button, three links ! hear give the thumbs-up It's not that bad luck for people who are , Every day will be full of vitality !^ _ ^ It's not easy to code words , Everyone's support is my driving force to stick to it . Don't forget to like it Focus on I oh ! If any of the above is inaccurate , Welcome to leave a message below . Or you have a better idea , Welcome to exchange and study together ~~~