• python-modules


    python模块的使用

     1 #! /usr/bin/env pyton3.5.4
     2 # -*- conding="utf-8" -*-
     3 
     4 # 使用sys模块
     5 from sys import *
     6 
     7 
     8 for i in argv:
     9     print(i)
    10 
    11     print('
    
    the PythonPath is', path, '
    ')
    12     
    13     
    14 # 模块的__name__:每个模块都有name。当name是main时,可单独运行:
    15 # 假如我们只想在程序本身被使用的时候运行主块,而在它被别的模块输入的时候不运行主块--可以通过模块的__name__属性完成
    16 '''
    17 __name__ = '__kobe__'
    18 
    19 if __name__ == '__main__':
    20     print('itself')
    21 else:
    22     print('kobe')
    23 '''
    24 
    25 # __doc__的使用
    26 '''
    27 def print_max(x, y):
    28     '
    29     The maximum of two numbers,
    30 
    31     the larger one.
    32     '
    33     x = int(x)
    34     y = int(y)
    35     if x > y:
    36         print('max is:', x)
    37     else:
    38         print('max is:', y)
    39 
    40 
    41 print_max(3, 6)
    42 help(print_max)
    43 print(print_max.__doc__)
    44 '''

        

  • 相关阅读:
    每日总结
    每日总结
    每日总结
    每日总结
    每周总结
    每日总结
    10.20
    10.19
    10.18
    10.17
  • 原文地址:https://www.cnblogs.com/DeRozan/p/7501831.html
Copyright © 2020-2023  润新知