除了一些文字外,我正在打印我最喜欢的游戏的列表。你知道吗
代码:
favGames = ["The Division", "WoW", "Legend of Zelda", "Super Smash Bros."]
print("Here are some of my favorite games! " + favGames)
期望值: 我只想得到一行:
Here are some of my favorite games! The Division, WoW, Legend of Zelda, Super Smash Bros.
我收到以下错误消息: TypeError:只能将list(而不是“str”)连接到list
尝试使用
str.join
,并通过命令和空格连接它:输出:
相关问题 更多 >
编程相关推荐