K12教育赛事综合服务平台
专注青少年竞赛题库网站
聚乐之家官方网站
下载聚乐之家官方App
students=[{"name": "小明", "has_cup": True}, {"name": "小红", "has_cup": False}, {"name": "小刚", "has_cup": True}]
[student["name"] for student in students if has_cup]
[name for student in students where student.has_cup]
[student["name"] for student in students if student["has_cup"]]
[student.name for student in students when student.has_cup]