import怪现象
- 问题很恑异
出在非期待被配置...
问题
esbat <esbatmop@gmail.com> reply-to python-cn@googlegroups.com to python-cn`CPyUG`华蟒用户组 <python-cn@googlegroups.com> date Thu, Mar 4, 2010 at 16:21 subject [CPyUG] import一个库后居然对其他库造成影响?
大家试一下如下代码
Toggle line numbers
1 import time
2 a='Mar'
3 time.strptime(a, "%b")
然后再试一下下面的代码
Toggle line numbers
1 import time,pynotify
2 a='Mar'
3 time.strptime(a, "%b")
就加了一个pynotify库,怎么就出错了?
原因
yuting cui <yutingcui@gmail.com> 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 <esbatmop@gmail.com> reply-to python-cn@googlegroups.com to python-cn`CPyUG`华蟒用户组 <python-cn@googlegroups.com> date Thu, Mar 4, 2010 at 22:27
解决了,确实是locale被改了,谢谢
反馈
创建 by -- ZoomQuiet [2010-03-04 14:54:58]