Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Sets Vs Lists Python Programmer Tips

Tags: unique set
Sets Vs Lists Python Programmer Tips

Sets are only useful when trying to ensure Unique items are preserved. Before sets where available, it was common to process items and check if they exist in a list (or dictionary) before adding them. List exampleHere unique is empty list. Every time I compare with this list, and if it is not duplicate then the input item will append to unique list. >>> unique = [] >>> for name in ['srini', '



This post first appeared on ApplyBigAnalytics, please read the originial post: here

Share the post

Sets Vs Lists Python Programmer Tips

×

Subscribe to Applybiganalytics

Get updates delivered right to your inbox!

Thank you for your subscription

×