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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -