class Foo:

    def __str__(self):
        return 'Foo as a string'

def __repr__(self):
    return '<Foo as repr, with \xc3\xa5\xc3\xa9\xc3\xa6 some non-ASCII>'
Using !s vs. :s to format a string in Python