Python input函数使用实例解析
2020-02-13 11:33
771 查看
这篇文章主要介绍了Python input函数使用实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
函数定义
def input(*args, **kwargs): # real signature unknown """ 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. If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError. On *nix systems, readline is used if available. """
函数用法
input() 阻塞式键盘输入,可以添加键盘提示信息。返回值永远是字符串类型。如果需要整型必须要强制类型转换。
name = input() print(name) name = input('请输入名字:') # 阻塞式 print(name)
以上就是本文的全部内容,希望对大家的学习有所帮助
您可能感兴趣的文章:
相关文章推荐
- python字典(dictionary)使用:基本函数code实例,字典的合并、排序、copy,函数中*args 和**kwargs做形参和实参
- Python中的高级函数map/reduce使用实例
- Python中使用ConfigParser解析ini配置文件实例
- python中input函数使用时遇到的问题
- Python命令行参数解析模块optparse使用实例
- 【python】如何批量读取文件夹的所有文件数据,os模块与open函数结合使用实例
- Python fileinput模块使用实例
- python常用函数使用方法实例
- Python List相关函数使用实例
- Python中使用ConfigParser解析ini配置文件实例
- python函数修饰符@的使用方法解析
- python zip()函数使用方法解析
- Python Numpy数组扩展repeat和tile使用实例解析
- 实例解析使用指针作为函数参数传递需要注意的问题
- Python fileinput模块使用实例
- Python过滤函数filter()使用自定义函数过滤序列实例
- 【Python】配置文件解析模块ConfigParser使用实例
- 通达OA二次开发,自动发起流程的函数解析与使用实例
- 【python】解析Excel中使用xlrd库、xlwt库操作,写入excel进阶完整脚本实例(五)
- 实例讲解Python的函数闭包使用中应注意的问题