This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Hervé Cauwelier
Recipients Hervé Cauwelier
Date 2010-12-09.15:33:41
SpamBayes Score 0.11469721
Marked as misclassified No
Message-id <1291908822.96.0.536076178004.issue10660@psf.upfronthosting.co.za>
In-reply-to
Content
Hexadecimals can be formatted to lower and uppercase:

>>> '{0:x}'.format(123)
'7b'
>>> '{0:X}'.format(123)
'7B'

I would like the same thing for strings:

>>> '{0.lastname:u} {0.firstname}'.format(user)
'DOE John'

I first thought using "S" for uppercase, but "s" is not available for lowercase. So I thought about "u" and "l".

The alternative is to write:

>>> '{0} {1}'.format(user.lastname.upper(), user.firstname)
'DOE John'

But I find it less compact and elegant.
History
Date User Action Args
2010-12-09 15:33:43Hervé Cauweliersetrecipients: + Hervé Cauwelier
2010-12-09 15:33:42Hervé Cauweliersetmessageid: <1291908822.96.0.536076178004.issue10660@psf.upfronthosting.co.za>
2010-12-09 15:33:41Hervé Cauwelierlinkissue10660 messages
2010-12-09 15:33:41Hervé Cauweliercreate