0

Trying to understand why the carriage return is adding a space before the line in the print statement like the following:

print(1, '\n', 2, '\n', 3)

returning

1
 2
 3
petezurich
  • 9,280
  • 9
  • 43
  • 57
kestrel
  • 126
  • 1
  • 16
  • broadly, it's `print()` adding them in .. you can use a structure like `"".join((vars..))`, simply append them together with `+`, or format them into a string to avoid this! (note the first two require you to call `str()`, while f-strings or `.format()` automatically do this for you – ti7 Apr 01 '22 at 18:16
  • 1
    This has the required answer https://stackoverflow.com/questions/25676970/print-multiple-lines-in-one-statement-without-leading-spaces – kestrel Apr 01 '22 at 18:33

0 Answers0