I was just expecting a new line character and written below code.
>>> print('\n', 'abc')
abc
>>>
But it gave single space also in front of the string abc, may I know why it added that space?
I am using Python 3.9 in Windows 10
CodePudding user response:
If given more than one argument, print
joins them with spaces, so you are effectively doing print("\n abc")
.
CodePudding user response:
The default separator (sep) argument to the print function is a whitespace. Change it for a empty string to remove that single space indentation:
print('\n', 'abc', sep='')