python 教程 第十五章、 结构布局

第十五章、 结构布局

#!/usr/bin/env python       #(1)起始行 

"this is a module"          #(2)模块文档 

import sys                  #(3)模块导入 

debug = True                #(4)全局变量定义 

class Fooclass(object):     #(5)类定义
    "Foo class"
    pass 

def test():                 #(6)函数定义
    "test function"
    foo = Fooclass()
    if debug:
        print 'run test()' 

if __name__ == '__main__':  #(7)主程序
    test()
posted @ 2011-10-13 12:16  方倍工作室  阅读(246)  评论(0编辑  收藏  举报