怎样在关键字处分割列表?
mathematica吧
全部回复
仅看楼主
level 1
比如列表lis={1, 2, a, 3, c, 45, 12, 7, d, 1, 3}中的关键字为a, c, d
怎样将其分割得到{{1, 2, a}, {3, c}, {45, 12, 7, d}, {1, 3}}
有直接实现这个功能的函数吗?
2020年01月04日 09点01分 1
吧务
level 12
lis = {1, 2, a, 3, c, 45, 12, 7, d, 1, 3};
keywords = {a, c, d};
Split[lis, FreeQ[keywords, #1] &]
2020年01月04日 12点01分 2
1