您的位置:首页 > 编程语言 > Python开发

python学习笔记8

2015-08-27 21:26 731 查看
主要讲了python的输入和输出
python通过[python2.x]raw_input和[python3.x]input来实现输入输出。
input可以加参数,表示为提示符,返回值为你的输入。

比如:
age = input("How old are you?")
print ("your age is %s", age)


How old are you?12

your age is %s 12

print可以通过end参数去除输出末尾的回车,换上end="??"中赋的末尾符号
比如:
print ("How old are you?", end=": ")
age = input();
print ("your age is %s", age)


How old are you?: 23

your age is %s 23
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: