zoukankan      html  css  js  c++  java
  • Python模块和模块引用(一)

    """
    import my_module as mm
    
    courses = ['History','Math','Physics','CompSci']
    
    index = mm.find_index(courses, 'Math')
    print (index)
    """
    
    """
    from my_module import find_index
    
    courses = ['History','Math','Physics','CompSci']
    
    index = find_index(courses, 'Math')
    print (index)
    """
    
    """
    from my_module import find_index as fi, test
    
    courses = ['History','Math','Physics','CompSci']
    
    index = fi(courses, 'Math')
    print (index)
    print(test)
    """
    
    """
    from my_module import *
    
    courses = ['History','Math','Physics','CompSci']
    
    index = find_index(courses, 'Math')
    print (index)
    print(test)
    """
    
    '''
    from my_module import find_index, test
    import sys
    
    courses = ['History','Math','Physics','CompSci']
    
    index = find_index(courses, 'Math')
    
    print(sys.path) # print out list of directories imported
    '''
    
    '''
    Imported my_module...
    ['/Users/Yao/python_learn', #this directory was added automatically
    '/Users/Yao/Documents',
    '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
    '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
    '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
    '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']
    '''
    
    '''
    import sys
    sys.path.append('Users/...') # add director for importing modules
    '''
    
  • 相关阅读:
    LruCache
    java 泛型的类型擦除和桥方法
    java Object解析
    android周期性任务
    阿里Sophix热修复
    android 广播
    《Android开发艺术探索》第11章 Android的线程和线程池
    RxJava2 源码分析
    android DDMS中的内存监测工具Heap
    Java的Unsafe类
  • 原文地址:https://www.cnblogs.com/yaos/p/14014370.html
Copyright © 2011-2022 走看看