In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the use of Python basic grammar". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the use of Python basic grammar"?
1. Numerical value
Values include integers and floating-point numbers, which correspond to integers and floating-point numbers, respectively, and the latter is more accurate.
two。 String
Strings, that is, the text we often come into contact with, can be of any length, enclosed in single or double quotation marks. It should be noted that Chinese and Chinese symbols can only appear within the string. If the comma of the Chinese input method is used in the third line below, Python will report an error.
3. List
A list is like a team with multiple variables stored in turn. A list is similar to a string, but each element in a string is a character, and each element in a list can be any type of variable.
Operations such as subscript access and assignment of list elements are similar to strings.
Use del to delete an element from the list.
4. Tuple
A tuple is similar to a list, except that the elements in the tuple cannot be changed after initialization, so they can be understood as a read-only variable.
5. Dictionaries
Dictionary is a very important variable type, which uses a key to access the corresponding value, that is, a data form of key-value pairs.
Learning is never a personal thing. If you want to have a partner who supervises each other, you need to study python or those who are interested in learning python can reply to Xiaobian "Learning" to get information and study together.
6. Annotation
The commented code will not run and can be seen as notes and instructions for yourself and other programmers to read to improve the readability of the code.
7. Reserved character
In Python, there are some strings that have certain functions, such as import, class, and so on. When choosing variable names, we should be careful to avoid these reserved characters.
8. Line and indent
In Python, the boundaries of code blocks are not explicitly delimited by symbols such as curly braces, but by line indentation. Continuous code with the same indentation level is in the same code block, and you need to pay attention to the indentation of each line of code when using syntax such as for, while, if, try, and so on.
9. Operator
The function of the operator is to generate new variables based on existing variables, mainly in the following ways:
Arithmetic operators: +, -, *, /,%, that is, add, subtract, multiply, divide, take remainder
Comparison operator: = =,! =, >, =
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.