美文网首页
Python: raw_input() vs input()

Python: raw_input() vs input()

作者: Sam_f32a | 来源:发表于2018-07-06 17:25 被阅读0次

Syntax

The syntax is as follows for Python v2.x:

mydata=raw_input('Prompt :')

print(mydata)

On Python v2.x:

raw_input is used to read text (strings) from the user.

input is used to read integers.

The syntax is as follows for Python v3.x as raw_input() was renamed to input() :

mydata=input('Prompt :')

print(mydata)

相关文章

网友评论

      本文标题:Python: raw_input() vs input()

      本文链接:https://www.haomeiwen.com/subject/ylebuftx.html