笨办法学python笔记:习题12 提示别人(pydoc和help使用)

age = input("How old are you? ")
height = input("How tall are you? ")
weight = input("How much do you weigh? ")
#明确了a=input("提示")的用法

print("So, you're %s old, %s tall and %s heavy."%(age,height,weight))

输出同上节
1.输入python -m pydoc input后,得到以下提示:

Help on built-in function input in module builtins:

input(prompt=None, /)
    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.

在python3.x中raw_input( )和input( )进行了整合,去除了raw_input( ),仅保留了input( )函数,其接收任意任性输入,将所有输入默认为字符串处理,并返回字符串类型。
给出的帮助信息主要是描述input()函数的使用方法:提示信息可给可不给,默认输出提示信息之后不换行。
2.输入q之后退出pydoc
3.pydoc主要用于调用python帮助信息,其实发现可以在命令行下直接用help(object)函数查询更简单
4.根据给出的信息,

open(file, mode=’r’, buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
Open file and return a stream. Raise IOError upon failure.
打开文件返回信息流,参数有文件名(必选),打开方式,寄存(?),编码方式,错误,换行,启动程序(?)
Programs that import and use ‘os’ stand a better chance of being portable between different platforms. Of course, they must then only use functions that are defined by all platforms (e.g., unlink and opendir), and leave all pathname manipulation to os.path (e.g., split and join).
os是个模块,含有大量与系统相关的可用函数,随系统平台变化(?),调用需要满足平台要求。
This module provides access to some objects used or maintained by the interpreter and to functions that interact strongly with the interpreter.
sys平台提供与编译器调用或相关的系统函数。

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值