Advertisement

我在最近的一段时间内对Python进行了深入的学习和实践

阅读量:

模块

复制代码
    #!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    
    ' a test module '
    
    __author__ = 'Lorenz Xu'
    
    import sys
    
    def test():
    args = sys.argv
    if len(args)==1:
        print('Hello, world!')
    elif len(args)==2:
        print('Hello, %s!' % args[1])
    else:
        print('Too many arguments!')
    
    if __name__=='__main__':
    test()
    
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
    

第1行注释使得hello.py文件能够在Unix/Linux/Mac系统中直接运行
第2行注释

全部评论 (0)

还没有任何评论哟~