Issue
Can't seem to find any links for information. Not sure if Spyder setting or what.
Script:
print("THIS IS MY TEST SCRIPT")
'''
Why do I print in the console?
'''
Console output:
In[3]: runcell(0, 'C:/Repos/OA/Sandbox/untitled0.py')
THIS IS MY TEST SCRIPT
Out[3]: '\nWhy do I print in the console?\n\n'
Question is why are my commented out lines printing in the console and can I turn it off?
Interesting to me it only prints the last comment. If I put anything after the comment, it does not print.
Right now, I'm ending my script with print("don't display anything") but I'd rather just turn off the comment display. Any way to do it?
print("THIS IS MY TEST SCRIPT")
'''
I don't print
'''
'''
I print
'''
Solution
Triple quotes are actually a multi-line string definition but they are commonly used for doc-strings (for functions, classes, modules, etc.). I assume spyder prints the output of the last statement. You can use single-line comments to avoid it: # comment ...
. Or have something else after the multiline comment.
Answered By - Yevhen Kuzmovych
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.