# Let's create a file and write it to disk.
filename = "test.dat"
# Let's create some data:
done = 0
namelist = []
while not done:
name = raw_input("Enter a name:")
if type(name) == type(""):
namelist.append(name)
else:
break
For the Python code above, I tried, but could not break from the while loop. It always asks me to "Enter a name:", whatever I input. How to break from the loop?
print name, repr(name), type(name),print type(""),print type(name) == type("")and so on, which would have shown the problem. You can seldom go wrong by strewing print statement around.