🛠️ Scheduled Maintenance | We’ll be undergoing scheduled maintenance and upgrades between 00:00 PST Jan 26th until 00:00 PST Jan 28th. There may be brief interruption of services in that period. We apologize for the inconvenience.

The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

Why does my print get erased?

Why does my print get erased?


I’m currently doing the Pyhton Bootcamp. I’m in the “Print” lesson. I tried to coding the home work and i did it like this:
print (“one, \’two\’, \”three\”, four, \five\ \n\tonce, \’i\’ caught a n\fish t\t\\’//alive\\\\'”)
The correcto one was (  print (“one, \’two\’, \”three\”, four, \\five\ \n\tonce, \’i\’ caught a n\ fish \n\t\t\’//alive\\\\'”)  )
I see that there are differences, but my question is, why is it that when I run the first option the answer shows up for less than a second and then it gets erased? (no error message or anything)
oh! this happened in Spyder in case it changes anything

1 Answer

365 Team

Hi Maria, 
Thanks for reaching out! 
In Python the \ is an escape character, which can be used with other characters which have special meaning in Python. For instance, 
\’ or \” produce inverted single or double commas. Here is a link to the Python’s documentation, where all the variations are listed.
The issue is because of the \five\ and n\fish. \f is a page-breaking character, which is used in printing. It forces the printer to eject the current page and start printing at the top of a new one. In Spyder this is what’s causing a new line in your console.
If you type \\five\ and n\ fish(add a space between n\ and fish) instead you should be able to see your print.

Thanks Eli! That was very helpful.