码迷,mamicode.com
首页 > 编程语言 > 详细

python 典型文件结构

时间:2015-03-28 18:44:22      阅读:273      评论:0      收藏:0      [点我收藏+]

标签:

 

#/usr/bin/env/ python            #(1) 起始行
"this is a test module"          #(2) 模块文档(文档字符串)

import sys
import os                 #(3) 模块导入

debug = True               #(4) (全局)变量定义
class FooClass (object):
    ‘foo class‘
    pass                           #(5) 类定义(若有) 
def test():
    ‘test function‘
    foo = FooClass()
    
    if debug:
        print ‘ran test()‘         #(6) 函数定义(若有) 
if  __name__ == ‘__main__‘:        #(7) 主程序 
    test()

 

python 典型文件结构

标签:

原文地址:http://www.cnblogs.com/hanframe/p/4374578.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!