This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
title: Python delattr() built-in function - Python Cheatsheet description: This is a relative of setattr(). The arguments are an object and a string. The string must be the name of one of the object’s attributes. The function deletes the named attribute, provided the object allows it. For example, delattr(x, 'foobar') is equivalent to del x.foobar.
Python delattr() built-in function From the Python 3 documentation This is a relative of setattr(). The arguments are an object and a string. The string must be the name of one of the object’s attributes. The function deletes the named attribute, provided the object allows it. For example, delattr(x, 'foobar') is equivalent to del x.foobar.class Person:
def __init__(self, name, age):
self.name = name
self.age = age
>>> person = Person("John", 30)
>>> delattr(person, 'age')
>>> person.__dict__
# {'name': 'John'}
class Car:
def __init__(self, make, model):
self.make = make
self.model = model
>>> car = Car("Toyota", "Corolla")
>>> try:
... delattr(car, 'year')
... except AttributeError as e:
... print(f"Error: {e}")
# Error: 'Car' object has no attribute 'year'