fork download
  1. yourlists = [
  2. ['4-7', '2-5', '2-9', '2-32', '2-16', '2-29', '2-13', '2-26', '2-20', '2-23'],
  3. ['2-32', '2-31', '2-36', '2-28', '2-34', '2-43', '2-41', '2-39']
  4. ]
  5.  
  6. result = [yourlist for yourlist in yourlists
  7. if any(node.startswith('4-') for node in yourlist)]
  8.  
  9. print result
Success #stdin #stdout 0.01s 6356KB
stdin
Standard input is empty
stdout
[['4-7', '2-5', '2-9', '2-32', '2-16', '2-29', '2-13', '2-26', '2-20', '2-23']]