Python set not empty but pop returns empty? [closed]
I saw a similar problem with multithreading but this isn't even multithreading, it's just straight up populating a set and then popping.
I print out the set and then immediately after, try to print out the pop of the set. but it says the set is empty when i see something like this for the set print out:
set(['', 'asdf', 'asdf, 'asdf'])
pop(...)
Remove and return an arbitrary set element.
Raises KeyError if the set is empty.
Since you have an empty string in your set, it is highly possible that a foo.pop()
returns this empty string and printing an empty string gives you nothing.
精彩评论