In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 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 "how to use the input,print,eval function of python". In the operation of actual cases, many people will encounter such a dilemma, so 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!
Input () function
The input () function can get the user's input through the console. This function can contain prompts to prompt the user for what type of value to enter, or it may not contain prompts.
No matter what value the user enters, the program is treated as a string
Usage
Variable is to get the information entered by the user for operation
Eval () function
The function of the eval function is to remove the outermost pair of quotation marks from the string, and then manipulate the string with the outermost quotation marks removed through the python statement.
Usage
Variable = eval (string) for example abc=eval ("123")
Variable is to get the value after the quotation marks are removed for operation. The input () function is usually used together to get the value entered by the user, using the variable = eval (input ()).
Print function
The first usage: direct output of a single variable or string, numerical value second usage: output multiple values at the same time, using print (value, value,., value), values and values are separated by commas, values and values are separated by spaces. The third use: mixed output is to use a template output, then fill in the corresponding variables on it, use the format function The following uses the example print ("{} between the number {} and the number {}" .format (variable 1, variable 2, variable 3), where the parenthesis is empty, and the following variable corresponds to the parenthesis one by one, and this variable can also be converted into an expression
There is a newline character at the end of the output of the print () function by default. If you want to remove the newline character, you can use the syntax print (variable, end= "symbol of substitution"), and the symbol in the double quotation marks will replace the newline character.
This is the end of the content of "how to use the input,print,eval function 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.