gpt4 book ai didi

Python3 – 在 f 字符串中用\n 分隔的打印列表

转载 作者:行者123 更新时间:2023-12-05 08:18:12 24 4
gpt4 key购买 nike

<分区>

我想在 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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com