In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how python3 uses f-strings to format strings. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Format the string with f-strings (Python 3.6 +)
This is a new feature since Python 3.6.It seems to me to be the best way to format strings. We just need to write an f in front of the string, and then we can use curly braces to access the variable in the string. This is simpler, simpler, and faster than the old formatting rules. In addition, we can write expressions that are evaluated at run time in curly braces. For example, if we want to output the square of the variable I, we can simply write this operation in the f string.
Name = "Alex" my_string = f "Hello {name}" print (my_string) # Hello Alex i = 10 print (f "{I} squared is {ibidi}") # 10 squared is 100 on "how to format strings in f-strings" is here. I hope the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good Please share it 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.
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.