zoukankan      html  css  js  c++  java
  • Python

    1- Python Manuals

    自带CHM格式的Python Manuals存放在Python<x.x>Doc目录下。
    可以在IDLE界面下按F1键或点击help选项下Python Docs标签打开;也可以在通过“开始 ---》python x.x ---》Python Manuals”打开。

    2- Module Docs

    包含了python中所有内置的和已经安装的第三方Modules文档信息
    通过“开始 ---》python x.x ---》Module Docs”打开,出现pydoc程序界面,可以在搜索框直接查找需要的内容。
    也可以点击“open browser”建立本地临时的web server,浏览网页版的文档信息。需要关闭时,点击“quit serving”即可。

    利用pydoc手工在指定端口打开web documentation server

    "python -m pydoc -p 6789" (表示打开pydoc模块来查看python文档,并在6789端口上启动web server)
    然后访问http://localhost:6789/,可以看到所有已经安装的Modules文档信息。需要关闭时,按“ctrl+c”可以终止命令或者关闭命令界面即可。

    利用pydoc在终端下查看文档信息

    在命令行执行“python -m pydoc 函数名或模块名”,可以看到自动生成的文档信息,按q键退出。
    例如:查看os模块文档"python -m pydoc os"
    例如:在当前目录生成dir函数的HTML文档"python -m pydoc -w dir"
    在Linux下同样适用pydoc方式查看文档。

    详细信息请查看:https://docs.python.org/3/library/pydoc.html

    3- help()和dir()

    help([object])
    Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

    • 查看对象信息:help([object])
    • 查看所有的keyword:help("keywords")
    • 查看所有的modules:help("modules")
    • 查看常见的topics: help("topics")
    • 查看模块,例如:help("sys")
    • 查看数据类型,例如: help("list")
    • 查看数据类型的成员方法,例如: help("list.append")

    对于已定义或引入的对象,help([object])查询不使用单引号和双引号。对于未引入的模块等对象,要使用单引号或双引号。

    dir([object])
    Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that object.
    查看当前属性及方法:dir()
    查看对象的属性及方法:>dir([object])
    dir([object]) 查询不使用单引号和双引号。

    注意:
    help()函数多用来查看对象的详细说明,按q键退出。dir()函数多用来查看对象的属性方法,输出的是列表。
    使用help()和dir()之前,确定查询的对象已被定义或引入,否则会报错:“NameError: name is not defined”。

    dir(__builtins__)  # 查看BIF(built-in functions)信息
    help(input)  # 参看input()函数的帮助信息
    

    4- 在线文档

        官方文档(https://docs.python.org/)是最具权威性质的说明和解释,利用搜索功能(https://docs.python.org/3/search.html)可以快速获取相关信息;

        官网中文文档:https://docs.python.org/zh-cn/

        其他文档:

    5- Q&A

        SegmentFault

        Stack Overflow

    6- 搜索与请教

    Google、百度、必应、牛人等等

    7- Python第三方库

  • 相关阅读:
    聊聊 Java8 以后各个版本的新特性
    如何使用SpringBoot封装自己的Starter
    Git原理入门解析
    Linux磁盘管理:LVM逻辑卷的拉伸及缩减
    LVM在线扩容
    Ubuntu setup Static IP Address
    ubuntu修改主机名
    user.sh
    升级Dell的R810固件版本
    DSET收集ESXi硬件日志
  • 原文地址:https://www.cnblogs.com/anliven/p/6022987.html
Copyright © 2011-2022 走看看