Python3.3 input v.s. raw_input


print("The world of python welcomes to you!")
name = raw_input("What is your name? ")
print("Hello, " + name + "!")

wKiom1MQkabiy3iBAAD6nj7DSrg928.jpg

print("The world of python welcomes to you!")
name = input("What is your name? ")
print("Hello, " + name + "!")

wKioL1MQkbCxfkm4AACHbleWK40374.jpg


在windows下双击附件hllo.py文件,运行结果:

wKioL1MQlCixdTE8AACl3lgL-YY601.jpg

最后一行代码改为raw_input函数,则程序运行完毕,来不及看结果,窗口也跟着关闭。

附件hello.py文件代码内容:

print("The world of python welcomes to you!")
name = input("What is your name? ")
print("Hello, " + name + "!")
input("Press <Enter>")


你可能感兴趣的:(python,raw_input,raw_input函数)