Scroll Down to See All▾
absaiterallanextanyasciibinboolbreakpointbytearraybytescallablechrclassmethodcompilecomplexdictdivmodenumerateevalexecfilterfloatformatfrozensetgetattrglobalshasattrhashhelphexidinputintisinstanceissubclassiterlenlistlocalsmapmaxmemoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypevarszip__import__clear_(dict)clear_(list)clear_(set)copy_(dict)copy_(list)copy_(set)fromkeysgetitemskeyspop_(dict)pop_(list)pop_(set)popitemsetdefaultupdatevaluescount_(tuple)count_(list)count_(str)index_(tuple)index_(list)index_(str)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindformatisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstripmaketranspartitionreplacerfindrindexrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: delattr
Description
Deletes the named attribute from the given object.
Extended Description
The delattr() function deletes the named attribute from the given object. It is equivalent to 'del object.name'. This function is particularly useful when you need to remove an attribute dynamically, or when the attribute name is determined at runtime.
Exceptions
- AttributeError: If the attribute doesn't exist
- TypeError: If the object does not support attribute deletion
Read More about delattr from Python Documentation
Function Signature
delattr(object: Any, name: str) -> None
Module: builtins
Parameters
object: The object from which to delete the attribute. name: A string containing the name of the attribute to be deleted.
Parameter List
- object: Any
- name: str
Return
This function doesn't return a value; it modifies the object in-place.
Return Type
None
Output
Explanation
This example demonstrates how to use delattr() to remove an attribute from an object.