Introduction to Python

One, python understanding

Python is a scripting language. Python is an object-oriented interpreted computer programming language. The grammar is concise and clear, and one of its features is to force whitespace as a statement indentation.

advantage:

Cross-platform, glue language, open source and free, rich library.

Disadvantages:

The running speed is slow, the code cannot be encrypted, scenarios, data analysis, network applications, and writing simple crawlers.

1、 IDLE

IDLE is python shell, shell means "shell", which is a way to interact with programs by typing text, just like the cmd windows in windows, they are all shells, and you can use them to give commands to the operating system. Use the IDLE shell to interact with python.

**2、 What does print() do? **

print() will display some text in the output window.

3、 BIF

BIF is Built-in Functions, built-in functions. In order to facilitate programmers to quickly write script programs, python provides a wealth of built-in functions that can be called directly.

For example, the function of print() is to "print to screen", and the function of input() is to receive user input. python3 provides 68 BIFs.

Enter dir (builtns) in python or IDLE to see the list of built-in methods provided by python (note that there are two underscores before and after builtins).

Two, python common syntax

**1、 The multiplication sign in python is * (asterisk). **

2、 Embed a double quotation mark in a string: Use a backslash () to escape the double quotation mark: ", or use single quotation marks to enclose the string.

**3、 Two completely different things cannot be added together in python, such as numbers and text. **

**4、 Add \n to the statement to wrap. **

You cannot add \ to the end of the original string, just add r in front.

**5、 The print statement uses the print() function. **

**6、 Comparison operator: **

A statement that is too long can be broken up into several lines using backslashes or parentheses.

Use semicolons to separate statements.

7、 loop statement:

**8、 Conditional branch: **

9、 Introducing foreign aid:

10、 Stitching

In some programming languages, you can "add" two strings together, for example:'I' +'Love' +'You' will get'I LoveYou'. In python, this practice is called concatenating strings.

**11、 Do you think'love' is the same as'Love'? **

Not the same, love and Love are completely different names, so be careful when programming.

If the identifier can be used in the code after it has been assigned (the python variable does not need to be declared first), the direct use of the unassigned identifier will cause a runtime error.

**12、 "=" and "= =" have different meanings. **

**= Indicates assignment. Variables must be assigned before using them. Variable names cannot start with numbers. Variable names can include letters, numbers, and underscores. **

**== Used to determine whether the values of two objects are equal. **

**Python does not allow assignment in if conditions, so if c=1: an error will be reported! **

**Note: **Indentation is the soul of python. The strict requirements of indentation make python code very streamlined and hierarchical. If you enter the colon ":" in the correct position, IDLE will automatically indent the next line.

Recommended Posts

Introduction to Python
python introduction
Introduction to Python related modules
Python from entry to proficiency (2): Introduction to Python
Introduction to Python commonly used visualization libraries
A quick introduction to Python regular expressions
Centos 6.4 python 2.6 upgrade to 2.7
Python PyQt5 finishing introduction
Centos default python2.6 upgrade to
Solution to python alignment error
Python introduction and environment installation
CentOS upgrade python2 to pyth
Python code to find bugs (2)
Python code to find bugs(7)
How to comment python code
Python code to find bugs (3)
Python code to find bugs(9)
How to learn python quickly
How to uninstall python plugin
How to understand the introduction of packages in Python
Python code to find bugs(6)
Python code to find bugs (1)
Python code to find bugs(8)
3 ways to encrypt Python files
How to understand python objects
Python code to find bugs(5)
How to use python tuples
Python| function using recursion to solve
Method steps to increase python font
python how to view webpage code
How to use python thread pool
Use python to query Oracle database
[Introduction to redis] Install redis under Centos
Use C++ to write Python3 extensions
Python novice learns to raise usage
Use python to achieve stepwise regression
How to wrap in python code
How to save the python program
Python implements 126 mailboxes to send mail
Using Python to implement multiple clipboards
How to omit parentheses in Python
How to install Python 3.8 on CentOS 8
Python example to calculate IV value
How to install Python 3.8 on Ubuntu 18.04
How to write classes in python
How to filter numbers in python
How to read Excel in Python
How to install Python on CentOS 8
How to solve python dict garbled
Steps to enter python through cmd
How to write return in python
How to view the python module
How to clear variables in python
How to understand python object-oriented programming
Python uses pdfkit to generate pdf [python]
Is python crawler easy to learn
Python handles operation code to execl
How to use SQLite in Python
Do python programs need to be compiled
Python multithreading
A practical guide to Python file handling