class Dummy(object):

    def __init__(self):
        self.value1 = 'A VALUE'
self.value2 = 'ANOTHER VALUE'
self.value3 = 'THIRD VALUE'

def to_s(self):
    return '{0.value1:<20},{0.value2:8},{0.value3:10}'.format(self)
Python fixed width string format using vars or __dict__