我有一个数据帧,例如:
Path Attribute
/home/accessbile/wheelchair type:threshold;width:42;gaurded:no
/home/accessible/wheelcahir type:threshold;width:45
/home/accessbile/armchair weight(lbs):100;width:30
/home/accessible/armchair type:foldind;weight(lbs):100;width:30
我需要在属性中获取关于路径的值(type、width、weight、gaurded,比如..)的唯一计数
输出:
PATH Attributes count
/home/accessbile/wheelchair type 2
/home/accessbile/wheelchair width 2
/home/accessbile/wheelchair gaurded 1
/home/accessbile/armchair weight(lbs) 2
/home/accessbile/armchair width 2
/home/accessbile/armchair type 1
尝试通过ast.eval
将属性转换为dict,并将键作为唯一计数。。但不起作用
首先,检查
Path
中所有行的拼写,一旦修复,可以执行以下操作:相关问题 更多 >
编程相关推荐