On Wed, 26 Apr 2017 18:56:40 -0600 Mats Wichmann <m...@wichmann.us> wrote:
> On 04/26/2017 06:33 PM, Phil 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? > > > > A little confused... why not just create it the way you want it? How > do you end up with {'1'} ? Thank you for your quick replies Mats and erky. I use .get() to retrieve a number from an entry box, which looks like {1} (no '' marks). If I then turn this number into a set then the result is {'1'}. num = self.entry_grid[row][col].get() self.solution[row][col] = set([num]) As I say, my project worked perfectly with just {1} until I discovered a bug further on in the code. Perhaps I should go back to my original version and the fix the bug in some other way? I did try {int(num)} but that resulted in an error that said something along the lines of int not being iterable. I'll have another look at that idea. -- Regards, Phil _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor