2006年01月23日 星期一 16:28
Zoom Quiet,您好! 受到启发,如下: dict([line.split(":") for line in s.splitlines() if len(line) > 0]) 谢谢Zoom Quiet和Slowness Chen。 Good luck cry 在 2006-01-23 16:15:00 您写道: >在 06-1-23,Slowness Chen<chenzh at bhh.com.cn> 写道: >> dict(line.split(':') for line in astring.split('\n')) >great! > >越来越 Pythonic 了 > >> ----- Original Message ----- >> From: "cry" <zyqmail at tom.com> >> To: "python" <python-chinese at lists.python.cn> >> Sent: Monday, January 23, 2006 3:00 PM >> Subject: [python-chinese] string to dict >> >> >> python,您好! >> >> 如下的字符串: >> """ >> ABC:123 >> DEF:456 >> ... >> """ >> 怎么方便的转换成字典?PYTHON下什么方法最简单呢? >> >> 谢谢 >> > >-- >"""Time is unimportant, only life important! >my blog: http://blog.zoomquiet.org/ >my wiki: http://wiki.woodpecker.org.cn/moin/ZoomQuiet >my book: http://www.douban.com/group/zoomquiet/ >""" >_______________________________________________ >python-chinese >Post: send python-chinese at lists.python.cn >Subscribe: send subscribe to python-chinese-request at lists.python.cn >Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn >Detail Info: http://python.cn/mailman/listinfo/python-chinese 致 礼! cry zyqmail at tom.com
2006年01月23日 星期一 16:29
""" 各位兄弟过年回家的也一路顺风啊! 回来之后就要启动一个大计划了,嘿嘿。plone相关的。 """ 嘿嘿,这么开心这么兴奋,原来明天就回家了 快过年了,大家一路顺风~~~~~ 有众人可以参与的部分吆喝一声~~
2006年01月23日 星期一 16:39
cry兄,空格需要考虑么 -----Original Message----- From: python-chinese-bounces at lists.python.cn [mailto:python-chinese-bounces at lists.python.cn]On Behalf Of cry Sent: Monday, January 23, 2006 4:28 PM To: python-chinese at lists.python.cn Subject: Re: Re: [python-chinese] string to dict Zoom Quiet,您好! 受到启发,如下: dict([line.split(":") for line in s.splitlines() if len(line) > 0]) 谢谢Zoom Quiet和Slowness Chen。 Good luck cry 在 2006-01-23 16:15:00 您写道: >在 06-1-23,Slowness Chen<chenzh at bhh.com.cn> 写道: >> dict(line.split(':') for line in astring.split('\n')) >great! > >越来越 Pythonic 了 > >> ----- Original Message ----- >> From: "cry" <zyqmail at tom.com> >> To: "python" <python-chinese at lists.python.cn> >> Sent: Monday, January 23, 2006 3:00 PM >> Subject: [python-chinese] string to dict >> >> >> python,您好! >> >> 如下的字符串: >> """ >> ABC:123 >> DEF:456 >> ... >> """ >> 怎么方便的转换成字典?PYTHON下什么方法最简单呢? >> >> 谢谢 >> > >-- >"""Time is unimportant, only life important! >my blog: http://blog.zoomquiet.org/ >my wiki: http://wiki.woodpecker.org.cn/moin/ZoomQuiet >my book: http://www.douban.com/group/zoomquiet/ >""" >_______________________________________________ >python-chinese >Post: send python-chinese at lists.python.cn >Subscribe: send subscribe to python-chinese-request at lists.python.cn >Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn >Detail Info: http://python.cn/mailman/listinfo/python-chinese 致 礼! cry zyqmail at tom.com _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年01月23日 星期一 16:58
在 06-1-23,Liming_Do<Liming_Do at smics.com> 写道: > cry兄,空格需要考虑么 > > Zoom Quiet,您好! > > 受到启发,如下: > dict([line.split(":") for line in s.splitlines() if len(line) > 0]) > > 谢谢Zoom Quiet和Slowness Chen。 > > Good luck > > cry > > 在 2006-01-23 16:15:00 您写道: > >在 06-1-23,Slowness Chen<chenzh at bhh.com.cn> 写道: > >> dict(line.split(':') for line in astring.split('\n')) > >great! > > > >越来越 Pythonic 了 > > > >> > >> python,您好! > >> > >> 如下的字符串: > >> """ > >> ABC:123 > >> DEF:456 > >> ... > >> """ > >> 怎么方便的转换成字典?PYTHON下什么方法最简单呢? > >> > >> 谢谢 > >> > > a =""" ABC:123 DEF:456 """ import re r = re.compile('(\w+):(\d+)', re.M) b = dict(r.findall(a)) print b -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit
2006年01月23日 星期一 17:02
If you are using python 2.4, I'd like to recommend Generator Expressions. It's more natural and memory-friendly. ----- Original Message ----- From: "cry" <zyqmail at tom.com> To: <python-chinese at lists.python.cn> Sent: Monday, January 23, 2006 4:28 PM Subject: Re: Re: [python-chinese] string to dict Zoom Quiet,您好! 受到启发,如下: dict([line.split(":") for line in s.splitlines() if len(line) > 0]) 谢谢Zoom Quiet和Slowness Chen。 Good luck cry 在 2006-01-23 16:15:00 您写道: >在 06-1-23,Slowness Chen<chenzh at bhh.com.cn> 写道: >> dict(line.split(':') for line in astring.split('\n')) >great! > >越来越 Pythonic 了 > >> ----- Original Message ----- >> From: "cry" <zyqmail at tom.com> >> To: "python" <python-chinese at lists.python.cn> >> Sent: Monday, January 23, 2006 3:00 PM >> Subject: [python-chinese] string to dict >> >> >> python,您好! >> >> 如下的字符串: >> """ >> ABC:123 >> DEF:456 >> ... >> """ >> 怎么方便的转换成字典?PYTHON下什么方法最简单呢? >> >> 谢谢 >> > >-- >"""Time is unimportant, only life important! >my blog: http://blog.zoomquiet.org/ >my wiki: http://wiki.woodpecker.org.cn/moin/ZoomQuiet >my book: http://www.douban.com/group/zoomquiet/ >""" >_______________________________________________ >python-chinese >Post: send python-chinese at lists.python.cn >Subscribe: send subscribe to python-chinese-request at lists.python.cn >Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn >Detail Info: http://python.cn/mailman/listinfo/python-chinese 致 礼! cry zyqmail at tom.com _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年01月23日 星期一 22:32
在 06-1-23,Liming_Do<Liming_Do at smics.com> 写道: > """ > 各位兄弟过年回家的也一路顺风啊! > 回来之后就要启动一个大计划了,嘿嘿。plone相关的。 > """ > 嘿嘿,这么开心这么兴奋,原来明天就回家了 > 快过年了,大家一路顺风~~~~~ > 有众人可以参与的部分吆喝一声~~ 哈哈,好!!狗年大家都发一发旺一旺!
2006年01月24日 星期二 22:39
On 1/23/06, Slowness Chen <chenzh at bhh.com.cn> wrote: > > If you are using python 2.4, I'd like to recommend Generator Expressions. > It's more natural and memory-friendly. but what's Generator Expression? ----- Original Message ----- > From: "cry" <zyqmail at tom.com> > To: <python-chinese at lists.python.cn> > Sent: Monday, January 23, 2006 4:28 PM > Subject: Re: Re: [python-chinese] string to dict > > > Zoom Quiet,您好! > > 受到启发,如下: > dict([line.split(":") for line in s.splitlines() if len(line) > 0]) > > 谢谢Zoom Quiet和Slowness Chen。 > > Good luck > > cry > > 在 2006-01-23 16:15:00 您写道: > >在 06-1-23,Slowness Chen<chenzh at bhh.com.cn> 写道: > >> dict(line.split(':') for line in astring.split('\n')) > >great! > > > >越来越 Pythonic 了 > > > >> ----- Original Message ----- > >> From: "cry" <zyqmail at tom.com> > >> To: "python" <python-chinese at lists.python.cn> > >> Sent: Monday, January 23, 2006 3:00 PM > >> Subject: [python-chinese] string to dict > >> > >> > >> python,您好! > >> > >> 如下的字符串: > >> """ > >> ABC:123 > >> DEF:456 > >> ... > >> """ > >> 怎么方便的转换成字典?PYTHON下什么方法最简单呢? > >> > >> 谢谢 > >> > > > >-- > >"""Time is unimportant, only life important! > >my blog: http://blog.zoomquiet.org/ > >my wiki: http://wiki.woodpecker.org.cn/moin/ZoomQuiet > >my book: http://www.douban.com/group/zoomquiet/ > >""" > >_______________________________________________ > >python-chinese > >Post: send python-chinese at lists.python.cn > >Subscribe: send subscribe to python-chinese-request at lists.python.cn > >Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > >Detail Info: http://python.cn/mailman/listinfo/python-chinese > > 致 > 礼! > > cry > zyqmail at tom.com > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- Yours, fluke fluke at sfcube.net http://sfcube.net/blog -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060124/26e9d788/attachment.htm
Zeuux © 2025
京ICP备05028076号