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? -

visual studio - Deleting lines of code in a text editor -

What's the encoding type of Android 2.2 push message? -