If I get the id of an object, how can I delete an object by it'开发者_Go百科s id ?
This is not a good idea. Try using the weakref module, which allows you to create weak references (analogous to symbolic links) to objects.
AFAIK objects are deleted by garbage collector in python. You can't force a delete yourself.
The id refers to a memory address. You "can't" delete (or free) a memory address, only its references, with the del statement
You can delete objects by calling del() on them. But AFAIK id won't help in that.
精彩评论