我是python的新手,我在同一目录中有两个python文件:
file1
import file2
file2.print_x(x)
file2
def print_x(x):
print(x)
我无法理解为什么运行file1.py时出现此错误
AttributeError: module 'file2' has no attribute 'print'
答案 0 :(得分:0)
您可以buff
你不能做get_next_line
编写elif x == "2":
state= input("\nPlease enter a State.\n")
with open("States and Capitals.txt", "r") as f:
for line in f:
if state.lower() in line.lower(): output=line
来查看file2中所有可用的功能