In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the data type knowledge points of Python". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the data type knowledge points of Python"?
Example of variable method Note using variable stored value name = "xxx"
Print ("name", name)
Consisting of lowercase letters, numbers, and underscores
String method for example note single quotation marks and double quotation marks can
B = "is a 'girl'"
Print ("b =", b)
C ='Is a "girl"'
Print ("c =", c)
Output:
B = is a 'girl'
C = Is a "girl"
Cannot use the same quotation marks
For example, b ='is a 'girl''
^
SyntaxError: invalid syntax
Additive stitching d = "find"
E = "who"
F = d + "" + e
Print ("f =", f) output: F = find who spaces, tabs, newline characters
Space
Tabs\ t
Newline character\ n
D = "find"
E = "who"
F = d + "" + e
Print ("f =", f)
Print ("xxxx\ nxxxx")
Print ("yyyy\ tyyyy")
Output:
F = find who
Xxxx
Xxxx
Yyyy yyyy
Function description Note title each word begins with an uppercase c ='Is a "girl"'
Print ("c =", c)
Print ("title =", c.title ())
Print ("upper =", c.upper ())
Print ("lower =", c.lower ())
Output:
C = Is a "girl"
Title = Is A "Girl"
Upper = IS A "GIRL"
Lower = is a "girl"
Upper all uppercase lower all lowercase lstrip delete opening blank g = "a b c"
Print ("'" + g + "'")
Print ("'" + g.lstrip () + "'")
Print ("'" + g.rstrip () + "'")
Print ("'" + g.strip () + "'")
Output, with spaces marked in red:
'a b c'
'a b c'
'a b c'
'a b c'
Rstrip delete ending white space strip delete beginning and ending blank number operator example Note addition, subtraction, multiplication and division +-* / N1 = 3
N2 = 2
Print (N2 / N1)
Common
The result of division is floating point:
0.6666666666666666
Multiplier * * N1 = 3
N2 = 2
The print (N2 * * N1) example is 2 ^ 3 and the output is 8. Parentheses ()
N1 = 3
N2 = 2
Print (N1 + N2 * 3)
Print ((N1 + N2) * 3)
Use parentheses to define the order of operations
Output:
nine
fifteen
Number to string function description Note strstr (number) returns a string
Convert the number directly to the string:
Print (str (3) + "find")
Convert numeric related variables to strings:
N1 = 3
Print (str (N1) + "find")
Annotation
Use the # logo to describe the code.
# the first use case print ("hello word-") has come to this point. I believe you have a better understanding of "what are the data type knowledge points of Python". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.