In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article shares with you the content of an example analysis of the basics of Python. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. The markers in python:
1. The name given to the variable is the marker.
Case-sensitive. MyName and myname are two different markers.
3. The first character can be underlined or begin with a letter, not a number. Chinese characters can be used as markers, but it is not recommended.
4. Keywords cannot be used as markers
5. Python built-in functions cannot be used as markers, such as print
2. Variable use in Python: 1. String variable
2. Floating point variable
3. Integer variable and bool variable
III. Sentences in Python
One line of code represents a statement. Generally speaking, a statement ends without a semicolon, either with or without a semicolon, and is not recommended. The Python programming specification is a statement.
No semicolon
1 、 a=b=c=10
2 、 a=b=c=20
You can assign values to abc.
IV. Comments in Python
Starts with #, followed by a space, followed by the contents of the comment
# comment content
It is OK without spaces, but it is recommended to add programming specifications.
You can make comments on a separate line, and you can follow them after the statement.
Use comments to tell Python to encode and put them on the first or second line
# coding=utf-8
You can also use #-- coding:utf-8--
5. Modules in Python:
A module is a file.
There are three forms of import modules:
1 、 inport
In this way, all code elements in the m2 module are imported, and the access needs to be prefixed with m2.
2 、 from import
This will import the x variable in m2 and do not need to be prefixed with m2 when accessing it.
3 、 from import as
This will import the x variable in m2 and give the variable an alias. There is no need to add the prefix m2 when accessing it.
Thank you for reading! This is the end of this article on "sample Analysis of Python basic knowledge points". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.