Jan-18-2024, 06:48 AM
hi
how can I see all attributes and methods related to a special type? for example, I want to see all methods and attributes related to lists, how can I do it?
I write in idle dir(list) and it shows some, but there is not del in the given list, but del can be used with list type to omit element(s) of it:
how can I see all attributes and methods related to a special type? for example, I want to see all methods and attributes related to lists, how can I do it?
I write in idle dir(list) and it shows some, but there is not del in the given list, but del can be used with list type to omit element(s) of it:
dir(list)
Output:['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
'del' in dir(list)
Output:False
mylist=[1,2,3,4,5] del mylist[2] mylist
Output:[1, 2, 4, 5]
del mylist[0:2] mylist
Output:[4, 5]
thanks