• 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
    '''
    
  • 相关阅读:
    kafka概述
    Spark网络通信分析
    spark序列化及MapOutputTracker解析
    spark checkpoint详解
    深入理解spark streaming
    spark Listener和metrics实现分析
    Spark SQL catalyst概述和SQL Parser的具体实现
    spark block读写流程分析
    java 分布式实践
    单元测试ppt
  • 原文地址:https://www.cnblogs.com/yaos/p/14014370.html
Copyright © 2020-2023  润新知