while True:
x = raw_input()
if x =="personal information":
print' Edward , Height: 5,10 , EYES: brown , STATE: IL TOWN: , SS:'
elif x =="journal":
name_of_file = raw_input("What is the name of the file: ")
completeName = "C:\\python\\" + name_of_file + ".txt"
file1 = open(completeName , "w")
toFile = raw_input("Write what you want into the field")
file1.write(toFile)
file1.close()
else:
break
the script keeps on giving me an error saying break is outside the loop are the indentations wrong?
解决方案
Yes, look at your post. Your else probably is meant to go with the if statement's indentation level.
else statements for while statements do entirely different things.