tags:

views:

78

answers:

4

can we remove a entry from the sets.

what are the commands to use for it?

like, my set conatins (6,5) , (6,7), (7,9)...I need to remove the second entry...what shud I do??

+3  A: 
my_set.remove((6, 7))

The remove() method can be used to remove items from a set.

Alex Gaynor
+1  A: 

If you've got a list of those tuples you can clear it out like this:

l = [(1,2),(3,4),(5,6)]

[(1, 2), (3, 4), (5, 6)]
l.remove((3,4))
[(1, 2), (5, 6)]
g.d.d.c
+3  A: 

You can use remove():

>>> s = set([1, 2, 3])
>>> s.remove(2)
>>> s
set([1, 3])
Bastien Léonard
+2  A: 

a -= set([(6, 7)])

:-)

Marco Mariani