In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what is the basic grammar of Python". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Variable
Constant, as the name implies, is the amount that the value cannot be changed, such as 5, 10, etc., or the text of a string. It literally means its own meaning and does not need much explanation.
What corresponds to a constant is a variable, which, as its name implies, is a quantity whose value is changing all the time. Because the value is changing, we need to give it a name, which is an identifier. In Python programming, we call the identifier the variable name and use the equal sign (=) to associate the variable name with the value
two。 Integer number
Integers are int types. In Python, integers can be calculated directly.
3.Python development environment
There are three mainstream Python development environments, namely PyCharm, Anaconda and Jupyter Notebook, which we call the Python three Musketeers. Anaconda, the most important is the installation of the overall development environment and third-party libraries is convenient; Pycharm, the main execution of the entire report script and the acquisition of various data sources and regular script execution; Jupyter notebook, the most important is model training, real-time execution of each step, you can visually see the results. ". This paragraph accurately summarizes the difference between the three.
4. String
A string is a series of characters. In Python, the contents of single, double, or triple quotes are strings. How to include single or double quotation marks in a string, python uses backslashes (\) to escape characters in the string.
5. List
A list is made up of a series of elements in a particular order. That is, a list is an ordered collection. In Python, the list is represented by square brackets ([]) and the elements are separated by commas. You can give the list a name and use (=) to associate the list name with the list, which is called list assignment.
6. Tuple
Lists are data structures that can be modified, while tuples are fixed-length data structures that cannot be modified by element values. Tuples are represented by parentheses (), while lists are represented by square brackets []. Please note the difference between the two.
7. Dictionaries
Dictionaries are another variable data structure and can store objects of any type, such as strings, numbers, lists, and so on. The dictionary is made up of keywords and values, namely key and value, separated by colons. This structure is similar to Xinhua Dictionary, in which every word has a corresponding explanation.
8. object-oriented
The first concept in object-oriented is class. In the Python programming language, a class is also a synthesis of similar things. For example, people have two arms, two legs and other characteristics; and people can walk, talk and other behavior. In Python language, these characteristics that describe things are called attributes, and the behaviors that represent things are called methods (that is, functions, in object-oriented, all behaviors are methods, there are no functions), and combining the two is the class of Python language. Class Class is used to describe a collection of things with the same properties and methods. That is, the class has the same properties and methods.
This is the end of the content of "what are the basic grammars of Python". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.