I have a nested list:
{{{1, 2, 3, 4, 5, 6}}, {{1}, {2, 3, 4, 5, 6}}, {{1, 2}, {3}, {4, 5, 6}}}
and would like to select only those lists out of it with two items in it:
{{{1}, {2, 3, 4, 5, 6}}}
How could this be achieved?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI have a nested list:
{{{1, 2, 3, 4, 5, 6}}, {{1}, {2, 3, 4, 5, 6}}, {{1, 2}, {3}, {4, 5, 6}}}
and would like to select only those lists out of it with two items in it:
{{{1}, {2, 3, 4, 5, 6}}}
How could this be achieved?
data = {{{1, 2, 3, 4, 5, 6}}, {{1}, {2, 3, 4, 5, 6}}, {{1, 2}, {3}, {4, 5, 6}}};
Select[data, Length @ # == 2 &]
{{{1}, {2, 3, 4, 5, 6}}}
Select[lst, Length@# == 2 &]
(see Select) $\endgroup$ – kglr Jun 19 '17 at 21:49Cases[lst,{_,_}]
$\endgroup$ – andre314 Jun 19 '17 at 21:58