如何将此代码作为一行打印?以下内容:
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?")
我这样做是为了让它更可读,我知道我可以用三重引号使它完全按照它的方式打印,并且我可以使用逗号将语句分成两行,但这会形成两个单独的字符串(我想)。有没有办法将语句保持为一个字符串并将其打印为一行?
最佳答案
相邻字符串文本隐式连接:
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?")