[Tutor] Sets question

boB Stepp robertvstepp at gmail.com
Wed Apr 26 21:07:47 EDT 2017


On Wed, Apr 26, 2017 at 7:33 PM, Phil <phil_lor at bigpond.com> wrote:
> Another question I'm afraid.
>
> If I want to remove 1 from a set then this is the answer:
>
> set([1,2,3]) - set([1])
>
> I had this method working perfectly until I made a change to cure another bug.
>
> So, I have a set represented in the debugger as {1,2,3} and again I want to remove the one. Only this time the one set is represented as {'1'} and, of course {'1'} is not in the set {1,2,3}.
>
> Ideally, I would like {'1'} to become {1}. Try as I may, I have not discovered how to remove the '' marks. How do I achieve that?

I probably don't understand what you are really trying to do, but

{1, 2, 3} - {int('1')}

does the obvious.  But I am guessing that this is not what you want.
Perhaps you can provide more context, or perhaps others can better
discern your needs?

boB


More information about the Tutor mailing list