I am a python beginner. I am trying to accept inputs from the user as long as he/she wishes. The program should stop accepting inputs when the enter key alone is pressed.
That is
25
65
69
32
#stop here since the enter key was pressed without any input
I came up with the following code of doing that....
a = []
while 1:
b = input("->")
if(len(b)>0):
a.append(b)
else:
break
Is there any other efficient 'pythonic' ways of doing this ?
While this works perfectly with python 3.3 it doesnt work with python 2.7 (with input() replaced by the raw_input() function). The screen just stays dumb without any response. Why is that?
Is there any inbuilt function with which i can convert strings back to integers!?