Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- class employee:
- def __init__(self, name):
- self.name = name
- def __str__(self):
- return "{clsname}(name={name})".format(
- clsname=self.__class__.__name__,
- name=self.name)
- class company():
- def __init__(self):
- for name in ('a', 'b', 'c', 'd', 'e', 'f'):
- setattr(self, name, employee(name))
- t = company()
- print(t.a)
- print(t.b)
Add Comment
Please, Sign In to add comment