Avatar ·

PEP 对 F-String 的转移

📁 python, 问题

我决定遵循我的代码编写规范,并面临如何在 Python 中进行字符串和表达式换行的问题。

def get_message(self) -> str: retu f'etip training: {self.training_type}; Duration: {self.duration:.3f} h.; Distance: {self.distance:.3f} km; Cf. Speed: {self.speed:.3f} km/h; The kcal was spent: {self.calories:.3f}.'
def get_spent_calories(self) -&