[Tutor] comparing two numpy arrays

Kent Johnson kent37 at tds.net
Wed Aug 8 13:11:16 CEST 2007

Andy Cheesman wrote:
> I've googled a bit for manipulation of
> sets into other data structure(lists, arrays) and not seen much. Is the
> only way of interconversion a brute force method?
> i.e	a = set([1, 2, 3])
> 	b = []
> 	for thing in a:
> 		b.append(thing)

No, a set is a sequence, you can convert it to a list directly:
b = list(a)


More information about the Tutor mailing list