Python 添加环境变量


目录示例

 

目的:在index中引入模块start下的方法

index.py

 1 #!/usr/bin/env python
 2 # -*- coding:utf-8 -*-
 3 
 4 
 5 import sys,os  6 BASE_DIR = os.path.dirname(os.path.dirname(__file__))  7 sys.path.append(BASE_DIR)  8 
 9 from conf import start
10 start.Say_hi()  # hello world

 

start.py

1 #!/usr/bin/env python
2 # -*- coding:utf-8 -*-
3 
4 
5 class Say_hi:
6     print('hello world')

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM