python中的input与raw_input

2025-07-07 06:40:59

1、进入python2版本中。

python中的input与raw_input

2、先试用input输入一段文字。不加双引号,就会报错,因为它并不是一个合法的表达式。

python中的input与raw_input

3、如果加上双引号,那么这段程序就可以直接运行了。

python中的input与raw_input

4、打开python3环境。

python中的input与raw_input

5、如果使用raw_input,会直接报错的,因为在python3中这个函数已经被移除了。

python中的input与raw_input

6、但是使用input的话,输入的内容加不加双引号都不会报错。

python中的input与raw_input
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢