Python 官方文档:入门教程 => 点击学习
input()函数用于读取标准输入注意:input函数的返回值类型为字符串 >>> num=input("Please input a number:") Please input a nu
input()函数用于读取标准输入
注意:input函数的返回值类型为字符串
>>> num=input("Please input a number:")
Please input a number:32
>>> type(num)
<class 'str'>
>>> num1=input("Please input the number1:")
Please input the number1:5
>>> num2=input("Please input the number2:")
>>> print("number1 + number2 =",(num1+num2))
number1 + number2 = 53
>>> print("number1 + number2 =",(int(num1)+int(num2)))
number1 + number2 = 8
>>> cus=input("Please input the custom name:")
Please input the custom name:Tom
>>> cid=input("Please input the custom ID:")
Please input the custom ID:001
>>> cus_info='''
custom_name:{0}
custom_id:{1}
'''.fORMat(cus,cid)
>>> print(cus_info)
custom_name:Tom
custom_id:001
--结束END--
本文标题: Python基础 input()的使用
本文链接: https://lsjlt.com/news/182893.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0