⬅︎ Back to Format thousands in Python
The single quotes come from the __repr__ method. If you do `print(repr('some string'))` the output becomes: 'some string'But if you do just `print('some string')` the output becomes: some stringSee https://docs.python.org/3/library/functions.html#reprIn the Python interactive shell if you just type a variable or expression and hit enter, it will automatically do `print(repr(thing))` for you. I.e.:>>> thing = 'string'>>> thing'string'
Comment
The single quotes come from the __repr__ method. If you do `print(repr('some string'))` the output becomes: 'some string'
But if you do just `print('some string')` the output becomes: some string
See https://docs.python.org/3/library/functions.html#repr
In the Python interactive shell if you just type a variable or expression and hit enter, it will automatically do `print(repr(thing))` for you.
I.e.:
>>> thing = 'string'
>>> thing
'string'