Pycharm一直说f是未定义的,即使它是。 我做错了什么?
def Main():
f = open("C:\Users\Donna\Desktop\myfile.txt","w")
for i in range(4):
f.write=(raw_input("Enter a word here")+'\n')
if __name__ =="__main__":
Main()
答案 0 :(得分:1)
def Main():
f = open("C:\Users\Donna\Desktop\myfile.txt","w")
for i in range(4):
f.write=(raw_input("Enter a word here")+'\n')
缩进有问题