Traditional Culture Encyclopedia - Weather inquiry - Why do print (f "* * * *") and Print(“* * * * * ") have different results when printing in python? They're just F.
Why do print (f "* * * *") and Print(“* * * * * ") have different results when printing in python? They're just F.
The difference between printing functions with and without f lies in printing expressions. When printing is an expression, printing with F can execute the expression, and printing without F just outputs the expression as a string. Next, let's use a concrete example to demonstrate:
1, write a function, and print out this function with f parameter, as shown in the figure below.
2. After executing the result, you can see that the expression function in print has been operated, as shown in the following figure.
3. Then remove the f parameter from the print, as shown in the figure below.
4. Next, you can see that the expression function in print is not calculated, and it is directly output as a string, as shown in the following figure.
- Previous article:I know the weather sometimes doesn't convey information.
- Next article:20 13 weather. When will this cold current end?
- Related articles
- Dreaming of signs that the sky is getting dark.
- What does it mean that there is no rain in summer?
- Measured Hao Ying hybrid version: extended-range electric vehicle+fuel vehicle+intelligent network connection =?
- What skin care brands can you recommend after the age of 25?
- What's the climate and temperature like in Korla, Xinjiang all year round?
- How many times does the weather station in Tararia need?
- 165438+ What's the weather like in Beijing in late October? How many clothes should I wear?
- Proverbs that use fog to forecast the weather.
- The price and detailed information of Wujiaochang Anbaili Festival walking champion skating rink?
- Do elephants attack people for no reason?