【发布时间】:2020-08-26 07:02:21
【问题描述】:
我想在 python3 的 f 字符串中打印一条带有由 \n 分隔的列表的消息。
my_list = ["Item1", "Item2", "Item3"]
print(f"Your list contains the following items:\n\n{my_list}")
期望的输出:
# Your list contains the following items:
# Item1
# Item2
# Item3
【问题讨论】:
标签: python python-3.x f-string