Google News
logo
Python - Interview Questions
How can we create an empty class in Python?
Empty class in Python is defined as a class that does not contain any code defined within the block. It can be created using pass keyword and object to this class can be created outside the class itself.
 
Example :
class x:
  pass
obj=x()
obj.id="123"
print("Id = ",obj.id)
 
Output : 123
Advertisement