##language:zh #pragma section-numbers off ##含有章节索引导航的 ZPyUG 文章通用模板 <> ## 默许导航,请保留 <> = import怪现象 = * 问题很恑异 * 出在非期待`被配置`... ##startInc == 问题 == {{{ esbat reply-to python-cn@googlegroups.com to python-cn`CPyUG`华蟒用户组 date Thu, Mar 4, 2010 at 16:21 subject [CPyUG] import一个库后居然对其他库造成影响? }}} 大家试一下如下代码 {{{#!python import time a='Mar' time.strptime(a, "%b") }}} 然后再试一下下面的代码 {{{#!python import time,pynotify a='Mar' time.strptime(a, "%b") }}} 就加了一个pynotify库,怎么就出错了? == 原因 == {{{ yuting cui sender-time Sent at 22:06 (GMT+08:00). Current time there: 10:53 PM. ✆ reply-to python-cn@googlegroups.com to python-cn@googlegroups.com date Thu, Mar 4, 2010 at 22:06 subject Re: [CPyUG] Re: import一个库后居然对其他库造成影响? }}} 没用过pynotify,是不是locale被pynotify设成系统默认的了? {{{ oldlocale=locale.getlocale(locale.LC_TIME) locale.setlocale(locale.LC_TIME,'C') time.strptime('Mar','%b') locale.setlocale(locale.LC_TIME,oldlocale) }}} == 确认 == {{{ esbat reply-to python-cn@googlegroups.com to python-cn`CPyUG`华蟒用户组 date Thu, Mar 4, 2010 at 22:27 }}} 解决了,确实是locale被改了,谢谢 ##endInc ---- '''反馈''' 创建 by -- ZoomQuiet [<>]