21 May
2014
21 May
'14
2:21 p.m.
Eric V. Smith added the comment: I suggest using whatever language explains what "u'%s' %obj" does. It's the same behavior.
From the SO question, given:
class A(object): def __str__(self): return 'as str' def __unicode__(self): return u'as unicode' Then:
'%s' % A() 'as str' u'%s' % A() u'as unicode'
and:
'{!s}'.format(A()) 'as str' u'{!s}'.format(A()) u'as unicode'
---------- nosy: +eric.smith _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21547> _______________________________________