问题描述
我在文件夹a和b中有两个名为test_def.py的python脚本。
在文件夹a的test_def.py中:
*def hello_function():
print ('hello! aaa')*
在文件夹b的test_def.py中:
*def hello_function():
print ('hello! 'bbb')*
#case 1
*os.chdir(folder a)
sys.path.append(folder b")
from test_def import *
hello_function()*
#你好! aaa
#case 2
os.chdir(folder a)
sys.path.insert(1,folder b)/ or sys.path.insert(0,folder b)
from test_def import *
hello_function()
#你好! bbb
#case 3
os.chdir(folder a)
from test_def import *
sys.path.insert(1,folder b)
from test_def import * #import again
hello_function()
#你好! aaa
在上述三种情况下,谁能让我知道阅读脚本的python搜索的区别?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)