【发布时间】:2020-11-05 13:03:18
【问题描述】:
我正在做一些代码重构,我遇到了这些坏人。他们的海豚是什么? 看起来像格式化程序,但我不太确定。
if data:
result = ''
for recipe_data in data:
url = recipe_data['url']
name = recipe_data['name']
rating = recipe_data['rating']
rating_count = recipe_data['ratingcount']
prep = recipe_data['prep']
cook = recipe_data['cook']
ready_in = recipe_data['ready in']
calories = recipe_data['calories']
result += """
{} {} 卡路里
谢谢。
【问题讨论】:
-
Python 字符串格式化? pyformat.info