教程集 www.jiaochengji.com
教程集 >  Python编程  >  Python入门  >  正文 python3怎么获取控制台输入的数据

python3怎么获取控制台输入的数据

发布时间:2021-02-07   编辑:jiaochengji.com
教程集为您提供python3怎么获取控制台输入的数据等资源,欢迎您收藏本站,我们将为您提供最新的python3怎么获取控制台输入的数据资源

python3获取控制台输入的数据的方法:可以利用input()函数来获取。python3为我们提供了input()函数,该函数用来接收一个标准输入数据,返回为string类型,使用方法如:【age = input()】。

Python3.x 中 提供了 input() 函数接受一个标准输入数据,返回为 string 类型。

(推荐教程:Python入门教程)

语法:

input([prompt])

参数prompt表示提示信息。

代码示例:

"""
接收控制台的输入
How old are you?
18
How tall are you ?
180
How much do you weigh?
50
So ,you are '18' old,'180' tall and '50' heavy,
 
python3的控制台输入函数时input();
"""
print("How old are you?");
 
age=input();
 
print("How tall are you ?");
 
height=input();
 
print("How much do you weigh?");
 
weight=input();
 
print("So ,you are %r old,%r tall and %r heavy," %(age,height,weight));

您可能感兴趣的文章:
python3怎么获取控制台输入的数据
input python怎么用
python中怎么获取输入的数
python input怎么用
python input是什么意思
python阶乘怎么写
php怎么返回数据到控制台
golang 大数据平台_从数据仓库到大数据平台再到数据中台
怎么查看django的版本
Python3爬虫入门:Selenium的使用

[关闭]
~ ~