Ask Your Question

Revision history [back]

Sometimes there is no any output from text file.

Hello!
Please explain me this code in Sage Notebook:
Cell 1:

f = open('/home/andrei/Docs/1.html')

Cell 2:

for s in f: print(s)

I type the code in cell 1 then in cell 2. First I press shift+enter in cell 1 then in cell 2. My code works fine. Then I press shift+enter in cell 2 - there is no any output. If after that I press shift+enter in cell 1 and then in cell 2 my code works again. Why?
Thanks a lot!

Sometimes there is no any output from text file.

Hello!
Please explain me this code in Sage Notebook:
Cell 1:

f = open('/home/andrei/Docs/1.html')

Cell 2:

for s in f: print(s)

I type the code in cell 1 then in cell 2. First I press shift+enter in cell 1 then in cell 2. My code works fine. Then I press shift+enter in cell 2 - there is no any output. If after that I press shift+enter in cell 1 and then in cell 2 -- my code works again. Why?
Thanks a lot!