为什么Python忽略了LC\u?

2024-06-16 11:14:17 发布

您现在位置:Python中文网/ 问答频道 /正文

[d33tah-pc][~] $ LC_ALL="pl_PL.UTF-8" date  
sob, 14 gru 2013, 00:26:48 CET
[d33tah-pc][~] $ LC_ALL="pl_PL.UTF-8" python
Python 2.7.5 (default, Nov 12 2013, 16:18:42) 
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strftime("%c")
'Sat Dec 14 00:26:57 2013'
>>> import locale
>>> locale.setlocale(locale.LC_TIME, 'pl_PL.UTF-8')
'pl_PL.UTF-8'
>>> time.strftime("%c")
'sob, 14 gru 2013, 00:27:09'

在这种情况下,Python为什么不使用系统的环境变量?你知道吗


Tags: importdatetimealllocaleutfpllc