In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how python uses the raw_input () function, which is very detailed and has a certain reference value. Friends who are interested must finish it!
Raw_input () function
Raw_input (): reads the input statement and returns the string string, ending with a newline character.
> name = raw_input ("please input your name:") please input your name:abc > print (name) abc > type (name)
Note: the difference between the input () and raw_input () function: (1) input supports the legal python table format "abc", and the string must be expanded in quotation marks; otherwise, it will report syntax errors (2) raw_input () returns all inputs as strings and returns string, while input () inputs numbers with its own characteristics, returning the input number type int or float.
# 1. Syntax error > name = input ("input your name:") input your name:abcTraceback (most recent call last:) File ", line 1, in File", line 1 In NameError: name 'abc' is not defined#2, correct input > name = input ("input your name:") input your name: "abc" > print (name) abc#3, input () data type > age = input ("your age:") your age:20 > type (age) # 4, Raw_input () data types are all str > age = raw_input ("your age:") your age:20 > type (age). These are all the contents of the article "how python uses the raw_input () function". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.