Python基础语法-菜鸟教程-函数用法:input()和raw_input()

1.input()和raw_input()用法
(1).input()
1)用法解释
def input(*args, **kwargs): # real signature unknown
“”"
Read a string from standard input. The trailing newline is stripped.

The prompt string, if given, is printed to standard output without a
trailing newline before reading input.

If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
On *nix systems, readline is used if available.
“”"
pass
2)使用实例
eg:有如下实例
value=input()
print(value)

输出结果为:
1
1
<class ‘str’>
​(2)raw_input()
Python3将raw_input和input进行整合成了input…去除了raw_input()函数…

其接受任意输入, 将所有输入默认为字符串处理,并返回字符串类型

发布了25 篇原创文章 · 获赞 0 · 访问量 218

猜你喜欢

转载自blog.csdn.net/qq_33410995/article/details/104181279