Converting DD MM YYYY into YYYY-MM-DD?

Ben Finney ben+python at
Tue Aug 18 12:03:47 CEST 2009

Gilles Ganault <nospam at> writes:

> dateinscription = "11 Août 2008"

For any text string that's not ASCII, you should specify it as Unicode.
(Actually, you should specify text as Unicode anyway.) For a literal
text string:

    dateinscription = u"11 Août 2008"

If you're using exclusively Python 3, you will get Unicode text literals
by default; but I assume you're using Python 2 based on existing

The principles of handling text in Python: Get it to internal Unicode
objects as soon as possible, handle it as Unicode for as long as
possible, and only encode it to some byte stream for output as late as

 \       “When a well-packaged web of lies has been sold to the masses |
  `\    over generations, the truth will seem utterly preposterous and |
_o__)                    its speaker a raving lunatic.” —Dresden James |
Ben Finney

More information about the Python-list mailing list