标签:ffffff oss color users pycha -o os.path and failed
不同目录间进行模块调用main.py 调用 login.py
#Author Kang
import os
import sys
# print(sys.path)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
#程序主目录
# print(BASE_DIR)
#/Users/kang/PycharmProjects/不破不立/第二章/20190129/ATM
sys.path.append(BASE_DIR)
#把当前环境变量追加到系统变量中
from core import login
login.ldap()
#结果:
请输入你的名字:kang
请输入你的密码:abc123
login successful!!!
#Author Kang
def ldap():
username = input("请输入你的名字:")
password = input("请输入你的密码:")
if username == "kang" and password == ‘abc123‘:
print(‘login successful!!!‘)
else:
print(‘login failed‘)
标签:ffffff oss color users pycha -o os.path and failed
原文地址:http://blog.51cto.com/12965094/2347503