【发布时间】:2021-02-08 17:09:48
【问题描述】:
import COVID19Py
covid19 = COVID19Py.COVID19()
latest = covid19.getLatest()
print(latest)
这是我的代码,输出是:
{'confirmed': 106160999, 'deaths': 2317170, 'recovered': 12778299}
但我希望输出类似于:
"There are 106160999 infections and 2317170 deaths and 12778299 recovers"
【问题讨论】:
-
这样基本的问题表明您可能会发现遵循一些有关 Python 中的字典和格式化字符串的教程会更有帮助。网上有很多这样的教程,Stack Overflow 不是其中之一。请使用tour,阅读what's on-topic here、How to Ask 和question checklist。欢迎来到堆栈溢出
-
只从字典中得到一个单词,您想要的结果如何?看起来你想要所有的单词,只是用英文格式化。
标签: python dictionary output