If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

stuck with python, please advise

so im trying to make it so that pressing enter without inputting any value, will break the loop, however, an empty string can be used because offor i in range(len(x_str_array)):
x[i] = int(x_str_array[i]) bit.

so that pressing enter without inputting any value, will break the loop

Code:

while True:
# Get some user input.
x_str = raw_input("Someting: ")
# If the user simply hits enter or supplies a string full of spaces, break.
if not x_str or x_string.isspace():
break
# More stuff here.