Python Forum
Geany 1.25 terminal not showing whitespace - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Geany 1.25 terminal not showing whitespace (/thread-10141.html)



Geany 1.25 terminal not showing whitespace - hudabaig - May-14-2018

Hello,

I am using Python 3.5 with Geany 1.25.

One of the exercises I cam across while studying python as a beginner was stripping whitespace from string.
I stored 'python ' as the value in variable favourite_language. The terminal should return me a value with a white space at the end of the word python, but I only see python with no indication of white space. It's a black terminal window.

How do see whitespace in my output?

Thanks!


RE: Geany 1.25 terminal not showing whitespace - snippsat - May-14-2018

Using print() it will not show quotes.
Example:
>>> # in a REPL it show quotes
>>> s = 'python '
>>> s
'python '
>>> s.strip()
'python'
 
>>> # print will not show quotes,if it's 1 or 10 whitespace it will not be visible
>>> print(s)
python 
>>> # Can use repr to show quotes
>>> print(repr(s))
'python '
>>> print(repr(s.strip()))
'python'