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