Einfache while-Schleife, bis break in Python

Was wäre eine sehr einfache while loop-Anweisung sein, würde weiterhin die unten Programm, bis der Benutzer "exit"?

Beispielsweise

while response = (!'exit')
    continue file
else
    break
    print ('Thank you, good bye!')
#I know this is completely wrong, but it's a try!

Meine Datei so weit:

#!/usr/bin/python
friends = {'John' : {'phone' : '0401',
        'birthday' : '31 July',
        'address' : 'UK',
        'interests' : ['a', 'b', 'c']},
    'Harry' : {'phone' : '0402',
        'birthday' : '2 August',
        'address' : 'Hungary',
        'interests' : ['d', 'e', 'f']}}
response = raw_input("Please enter search criteria, or type 'exit' to exit the program: ").split()
try:
    print "%s's %s is %s" % (response[0], response[1], friends[response[0]][response[1]])
except KeyError:
    print "Sorry, I don't know about that. Please try again, or type 'exit' to leave the program: "
also meine wichtigste Frage ist, ob es eine bestimmte Aussage, die heißt "weiter mit der Datei"

InformationsquelleAutor user1374310 | 2012-05-05

Schreibe einen Kommentar