python - Is while True: a suitable way to repeat a block until an accepted case is reached? -


is while true accepted method looping on block of code until accepted case reached below? there more elegant way this?

while true:     value = input()     if value == condition:         break     else:         pass # continue code here. 

thank input.

that's way in python. don't need else: pass bit though.

note, in python 2.x you're want raw_input rather input.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -