Python terminal not working for for loops [closed]

I ran this code in the Python terminal:

>>> for news in news_list:
...     print news("li", {"class", "first"})[0].a["href"]
...     
...     

I want to be able to close this for loop in the terminal, but I have no idea how to. I tried pressing Enter twice but it doesn't work.


It doesn't matter what data he is working on. Either way you're just using print "spam" or some complicated expression, the for-loop should be closed after two enters or a Python exception will be raised either with bad data or a syntax error.

The problem is you're indenting the empty lines, so the interpreter thinks you're still going to give it some code.

See the difference in below code snippet (select the text to see why):

>>> for x in range(4):
...     print x
... 
0
1
2
3
>>> for x in range(4):
...     print x
...     
...     
...     
... 
0
1
2
3
>>>