我在python
中有这个list of list
,我想使用一个打印语句只打印主列表中每个列表中的最后2个项目。以下是我的示例列表:[['Violet', 1, '219'], ['Yellow', 2, '235'],['Yellow', 1, '25']]
。我基本上是想打印上面的样本数据是这样的:在python中打印列表中某些列的错误
Following are the rooms that are currently available - {Floor:1,Room Number: 219},{Floor:2,Room Number:235},{Floor:1,Room Number: 25}
这里是一个print语句我写道:
print("Following are the rooms that are currently available - - "+ str((",".join(lst))))
当我执行此我得到错误的TypeError: sequence item 0: expected str instance, list found
我仍然在学习python,因此我无法找到一种方法在上面显示的所需输出中打印我的列表并解决此错误。我怎样才能做到这一点?
变量'lst'的内容是什么? –