-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/02/14 00:58, Dave Angel wrote: > Bob Williams <li...@barrowhillfarm.org.uk> Wrote in message: > > >> to slice those lines to get the artist and album names into a >> list. >> >> So far, so good but my output contains duplicates, so my final >> task is to work out how to get rid of them. >> > > > Hint: a set will contain only one of each item. So if you have a > list of immutable items, the following will eliminate duplicates: > > newlist = list (set (oldlist)) > > Sometimes a dict is better, if only part of each item is to be > made unique. > > This assumes that order doesn't matter. If it does, perhaps an > ordered dict. > Many thanks, Dave. That worked perfectly. Ordering doesn't matter in this case, but I might try it as an exercise.
Bob - -- Bob Williams System: Linux 3.11.10-7-desktop Distro: openSUSE 13.1 (x86_64) with KDE Development Platform: 4.12.2 Uptime: 06:00am up 2 days 10:01, 5 users, load average: 0.35, 0.31, 0.21 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlL7QxsACgkQ0Sr7eZJrmU6I+gCffgK34BBSBPQ02ZjAKm/TwlUQ VyoAn1etNjuywwWIa1e2fqx9YlGeXGu9 =NhPX -----END PGP SIGNATURE----- _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor