zl程序教程

您现在的位置是:首页 >  后端

当前栏目

python输入input的用法

Python输入 用法 input
2023-09-11 14:15:15 时间

1. 输⼊

        在Python 中,程序接收⽤户输⼊的数据的功能即是输⼊。

1.2 输⼊的语法

input("提示信息")

1.3 输⼊的特点

  • 当程序执⾏到 input ,等待⽤户输⼊,输⼊完成之后才继续向下执⾏。
  • Python中, input 接收⽤户输⼊后,⼀般存储到变量,⽅便使⽤。
  • Python中, input 会把接收到的任意⽤户输⼊的数据都当做字符串处理。【input接收的任何数据默认都是字符串数据类型】

示例代码:

password = input('请输⼊您的密码:')
print(f'您输⼊的密码是{password}')
# <class 'str'>
print(type(password))

运行结果: