如今,在Python 2.7及更高版本中,你可以使用dict理解:
{k: v for k, v in points.iteritems() if v[0] < 5 and v[1] < 5}在Python 3中:
{k: v for k, v in points.items() if v[0] < 5 and v[1] < 5}
如今,在Python 2.7及更高版本中,你可以使用dict理解:
{k: v for k, v in points.iteritems() if v[0] < 5 and v[1] < 5}在Python 3中:
{k: v for k, v in points.items() if v[0] < 5 and v[1] < 5}