locale « Format « Python Data Type Q&A

Home
Python Data Type Q&A
1.array
2.date
3.dictionary
4.Format
5.integer
6.List
7.numpy
8.regex
9.string
10.tuple
Python Data Type Q&A » Format » locale 

1. Locale date formatting in Python    stackoverflow.com

How do I get datetime.datetime.now() printed out in the native language?

    >>> session.deathDate.strftime("%a, %d %b %Y")
    'Fri, 12 Jun 2009'
I'd like to get the same ...

2. Format date based on locale in python    stackoverflow.com

I have a date output like

>>> import time
>>> print time.strftime("%d %B")
19 July
Is there a way to format the date based on the locale, but still have control of what is shown ...

3. Python: date formatted with %x (locale) is not as expected    stackoverflow.com

I have a datetime object, for which I want to create a date string according to the OS locale settings (as specified e.g. in Windows'7 region and language settings). Following Python's

4. String formatting python    stackoverflow.com

I am trying to understand what option value n exactly does in string formatting for the type flag. PEP 3101 says (in the section on available integer types):

'n' - ...

5. Why does Python store German and Spanish (and other?) time format strings as %T in the locale module?    stackoverflow.com

I'm writing a test for a program that will be used in multiple locales. While running the test in German, i got the error

Traceback (most recent call last):
  File "<stdin>", ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.