- 论坛徽章:
- 1
|
本帖最后由 jun413947139 于 2014-07-31 11:25 编辑
1. python 中__doc__是第一个未赋值的字符串(docstring),并不是注释, 所以你用# 开头的注释是不行的
2. __doc__ 支持 python的modules, functions, classes, and methods
3. 以你的mget.py为例 :- #! /usr/bin/python
- '''
- mget.py
- by Nelson Rush
- MIT/X license.
- A simple program to download files in segments.
- - Fixes by David Loaiza for Python 2.5 added.
- - Nelson added fixes to bring the code to 2.7 and add portability between Windows/Linux.
- - The output of segment information has been corrected and cleaned up.
- - In outside cases where the client instances were not being closed, they are now closed.
- '''
- import sys
- import os
- import asyncore
- import socket
- import platform
- from string import *
- from math import *
- from time import *
- from mmap import *
复制代码 在python shell中执行- >>> import mget
- >>> mget.__doc__
复制代码 |
|