python - How to eliminate duplicate key value pair inside a list -


this question has answer here:

[     {'date': '08/11/2016', 'duration': 13.0},      {'date': '08/17/2016', 'duration': 5.0},      {'date': '08/01/2016', 'duration': 5.2},      {'date': '08/11/2016', 'duration': 13.0},      {'date': '08/11/2016', 'duration': 13.0},      {'date': '08/11/2016', 'duration': 13.0} ] 

if data that.

one easy not efficient solution can be:

a = [{'date': '08/11/2016', 'duration': 13.0}, {'date': '08/17/2016', 'duration': 5.0}, {'date': '08/01/2016', 'duration': 5.2}, {'date': '08/11/2016', 'duration': 13.0}, {'date': '08/11/2016', 'duration': 13.0}, {'date': '08/11/2016', 'duration': 13.0}] b = [] c in a:    if c in b:       continue    b.append(c) print(b) 

Comments

Popular posts from this blog

java - AEM: 403 Forbidden occurs when call a Post servlet -

ruby on rails - ActiveRecord order not working -

Google Alert - facebook