`第一个程序:First.py
list=["ab","cd","ef"]
for i in list:
with open("input.txt", "w") as input_file:
print(" {}".format(i), file = input_file)
预期产量:
ab
cd
ef
但我得到了输出:
ef
第二个程序:Second.py
input_file = open('input.txt','r')
for line in input_file:
if "ef" in line:
print(line)
预期产量:
英孚
得到输出:
英孚
现在我想直接调用first.py中的文本文件(input.txt)并在second.py中使用它?`如何从其他程序python调用函数?
编辑:应用的代码块