我需要做什么(要加载的模块,要调用的语言环境方法等),以便在我调用时:
datetime.date(2009,1,16).strftime("%A %Y-%b-%d")
Run Code Online (Sandbox Code Playgroud)
而不是得到:
Out[20]: 'Friday 2009-Jan-16'
Run Code Online (Sandbox Code Playgroud)
我得到西班牙语/法语/德语/ ...输出
Out[20]: 'Viernes 2009-Ene-16'
Run Code Online (Sandbox Code Playgroud)
无需更改我的整个操作系统的语言环境(即只使用python调用动态设置语言环境并保持我的应用程序范围内的更改)
谢谢.
在Ubuntu上,
$> sudo locale-gen es_ES.UTF-8
$> sudo dpkg-reconfigure locales
$> python
>>> import locale
>>> locale.setlocale(locale.LC_TIME, 'es_ES.UTF-8')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9669 次 |
| 最近记录: |