Are all items in list the same?
Bob van der Poel
bob at mellowood.ca
Mon Jan 7 19:14:14 EST 2019
I need to see if all the items in my list are the same. I was using set()
for this, but that doesn't work if items are themselves lists. So, assuming
that a is a list of some things, the best I've been able to come up with it:
if a.count( targ ) == len(a):
I'm somewhat afraid that this won't scale all that well. Am I missing
something?
--
**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob at mellowood.ca
WWW: http://www.mellowood.ca
More information about the Python-list
mailing list