0 votes
in Python by
How can we create an empty class in Python?

1 Answer

0 votes
by
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

Related questions

0 votes
asked Sep 4, 2021 in Python by SakshiSharma
0 votes
asked Oct 11, 2021 in Python by rajeshsharma
...