五、输入与输出

1、接收用户输入

  name=input('请输入你的名字:')

2、格式化输出

  print('my name is %s my age is %s' %(name,age))

  %d只能接收数字

    print('my age is %d' %10)

了解:
    在python3中只有一个input:input会将用户输入的任何内容都存成字符串类型
    在python2中有两种接收用户输入的机制
    raw_input:等同于python3的input
    input:要求输入者必须输入的一个明确的数据类型,输入什么类型就存成什么类型
原文地址:https://www.cnblogs.com/lakei/p/10567206.html