Python 查找表格中包含 'started' 的第一列内容
可以使用一个简单的循环来完成查找表格中包含 'started' 的行的第一列内容的任务:
for line in data:
if 'started' in line[0]:
print(line[0])
该代码首先遍历表格数据 data 中的每一行 line。然后,它检查该行的第一列内容 line[0] 是否包含字符串 'started'。如果包含,则打印该行的第一列内容 line[0]。
例如,如果您有一个表格数据如下:
['task', 'status']
['clean the house', 'completed']
['buy groceries', 'started']
['wash the car', 'pending']
那么,运行上面的代码将输出:
buy groceries
因为这行的第一列内容包含 'started'。
原文地址: https://www.cveoy.top/t/topic/ljAA 著作权归作者所有。请勿转载和采集!