您可以在整个表达式周围加上括号:
return ("a Parallelogram with side lengths {} and {}, and interior " "angle {}".format(self.base, self.side, self.theta))或者您仍然
可以继续使用表达式,只需使用单独的字符串文字即可:return "a Parallelogram with side lengths {} and {}, and interior " "angle {}".format(self.base, self.side, self.theta)注意,不需要
+在字符串之间放置;Python自动将连续的字符串文字连接为一个:
>>> "one string " "and another"'one string and another'
我自己更喜欢括号。
该
str()电话是多余的;
.format()默认情况下会为您执行此操作。



