Avatar ·

Delete a dictionary from the list of dictionaries

📁 lambda, список, словарь, python

I have a list with dictionaries. Where the person’s name is indicated, where and where it goes. But one dictionary has no meaning "from" from ". How to delete this dictionary from the list?

  Tour = [ {  "name" ": ,  :  "" "Moscow" ",  :  "" Kazan ""  },  {  "name" ": ,   "" from ":  "Moscow" ",  :  "" Kazan " },  { " "NAME" " "" Sergey "" ,   "to" ":  } ]     

I tried to do it in several ways, but nothing It tus out

  #method 1  new_tour = [i  for  i  in  tour  if  (I [ 'from "] ==  none )]  #method 2  new_tour =  line  ( filter  ( lambda  i: I [ 'compers] ]! = = "  none , tour))  #method 3    for  i  in   range  ( len  (Tour)):   if  tour [i] [ 'from "] ==  none :   del  tour [i]   break