python中raw input的用法,Python基本语法-新手教程-函数用法:input()和raw_input(),基础,菜鸟,rawinput...

本文介绍了Python中input()和raw_input()函数的用法。input()函数读取标准输入并移除尾部换行符,若用户输入EOF则引发EOFError。在Python3中,raw_input()被整合进input(),默认将所有输入视为字符串处理。
摘要由CSDN通过智能技术生成

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

​(2)raw_input()

Python3将raw_input和input进行整合成了input…去除了raw_input()函数…

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值