Python Forum
Undesired space after using \n in print
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Undesired space after using \n in print
#3
>>> help(print)
Help on built-in function print in module builtins:

print(...)
    print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
    
    Prints the values to a stream, or to sys.stdout by default.
    Optional keyword arguments:
    file:  a file-like object (stream); defaults to the current sys.stdout.
    sep:   string inserted between values, default a space.
    end:   string appended after the last value, default a newline.
    flush: whether to forcibly flush the stream.
So this give a hint that newlineđź‘€ is default.
x = [1, 2, 3]
print(x)
print(x)
Output:
[1, 2, 3] [1, 2, 3]
Reply


Messages In This Thread
Undesired space after using \n in print - by Tuxedo - Mar-03-2021, 09:48 PM
RE: Undesired space after using \n in print - by snippsat - Mar-03-2021, 09:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Remove a space between a string and variable in print sie 5 1,853 Jul-27-2022, 02:36 PM
Last Post: deanhystad
  Hiding "undesired" info Extra 4 1,838 Jan-03-2022, 08:25 PM
Last Post: Extra
  from global space to local space Skaperen 4 2,372 Sep-08-2020, 04:59 PM
Last Post: Skaperen
  how to add a coma in print statement of python without preceding space character? brittocj 3 3,207 Sep-27-2018, 09:03 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020