data_file.py --> 以下是data_file.py的内容
numbers = [1,2,3,4,5]
alpha = ['a','b','c','d','e']
D_num_alpha = dict(zip(numbers,alpha))
new_python.py
data_file = '/Users/user/desktop/data_file.py'
open(data_file,'r').read()
print numbers
>>>NameError: name 'numbers' is not defined
我正在尝试使用在 new_python.py 内部的 data_file.py 中制作的字典,但我只能将其读入字符串。