列表解析或map处理数据表
1 >>> studentInfo=[('张三',28,'男'),("李四",18,'女'),('王五',22,"男")] #学生表,3行3列 2 >>> [name for (name,age,sex) in studentInfo] 3 ['张三', '李四', '王五'] 4 >>> list(map(lambda row:row[1],studentInfo)) 5 [28, 18, 22]
1 >>> studentInfo=[('张三',28,'男'),("李四",18,'女'),('王五',22,"男")] #学生表,3行3列 2 >>> [name for (name,age,sex) in studentInfo] 3 ['张三', '李四', '王五'] 4 >>> list(map(lambda row:row[1],studentInfo)) 5 [28, 18, 22]