In this example we will show how to form a dictionary in the object of the class with Python.
Source Code
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
class A(object):
def __init__(self):
self.a = 6
self.b = 8
def do_nothing(self):
pass
c = A()
print(c.__dict__)
Output:
{'b': 8, 'a': 6}