input在python中的用法

如题所述

input在python中的用法如下:

工具:华为MateBook14、系统Windows10、软件Python1.0。

1、Python中获取键盘值的方式:input()函数,然后打印该数据。

2、也可以指定输入的类型,Python有六个标准数据类型分别是:Number(数字)、String(字符串)、List(列表)、Tuple(元组)、Set(集合)及Dictionary(字典)。

3、input()获取的值Python会默认类型为str。如果直接赋值将会自动默认数据类型。

4、input()函数解释如下:Read a string from standard input. The trailing newline is stripped.指的是输入之后,按的回车The prompt string, if given, is printed to standard output without a trailing newline before reading input。

5、组合其他函数也有不同的用法。例如,eval(input())。

温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜