How to make print expression single line in python?

How to make this code print as one line ?:

 print("If a hippo ways 2000 pounds, gives birth to a 100 pound calf and
          then eats a 50 pound meal how much does she weigh?")

I have this way to make it more readable, I know that I can use triple quotes to make it print exactly as it is, and that I can use a comma to split the statement into two lines, but that would make two separate strings (think). is there a way to save the statement as one line and print it as one line?

+4
source share
2 answers

Adjacent string literals are implicitly concatenated:

print("If a hippo ways 2000 pounds, gives birth to a 100 pound calf and "
       "then eats a 50 pound meal how much does she weigh?")
+13
source
print("If a hippo ways 2000 pounds, gives birth to a 100 pound calf and "\
      +"then eats a 50 pound meal how much does she weigh?")
+1
source

Source: https://habr.com/ru/post/1523963/


All Articles