2008年01月17日 星期四 13:16
Hello ! str="(aaa)(bbb)(ccc)" 想将其转成一个list : [ "aaa", "bbb", "ccc" ] 请问如何做比较合适? Thanks! Regards Falls
2008年01月17日 星期四 13:22
p = re.compile('[(](.+?)[)]') a = "(aaa)(bbb)(ccc)" print p.findall(a) >>['aaa', 'bbb', 'ccc'] 2008/1/17, huang falls <falls1977在gmail.com>: > > Hello ! > > str="(aaa)(bbb)(ccc)" > > 想将其转成一个list : > > [ "aaa", "bbb", "ccc" ] > > 请问如何做比较合适? > > Thanks! > > Regards > Falls > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- 茫茫人海,你是我的最爱 -------------- 下一部分 -------------- 一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20080117/bebb6979/attachment.html
2008年01月17日 星期四 15:22
s[1:len(s)-1].split(')(') huang falls wrote: > Hello ! > > str="(aaa)(bbb)(ccc)" > > 想将其转成一个list : > > [ "aaa", "bbb", "ccc" ] > > 请问如何做比较合适? > > Thanks! > > Regards > Falls > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2008年01月17日 星期四 15:44
print str[1:-1].split(')(') > Date: Thu, 17 Jan 2008 15:22:15 +0800> From: redack在gmail.com> To: python-chinese在lists.python.cn> Subject: Re: [python-chinese] ÇëÎÊÒ»¸öÕýÔòµÄÎÊÌâ> > s[1:len(s)-1].split(')(')> huang falls wrote:> > Hello £¡> >> > str="(aaa)(bbb)(ccc)"> >> > Ï뽫Æäת³ÉÒ»¸ölist :> >> > [ "aaa", "bbb", "ccc" ]> >> > ÇëÎÊÈçºÎ×ö±È½ÏºÏÊÊ£¿> >> > Thanks!> >> > Regards> > Falls> > _______________________________________________> > python-chinese> > Post: send python-chinese在lists.python.cn> > Subscribe: send subscribe to python-chinese-request在lists.python.cn> > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn> > Detail Info: http://python.cn/mailman/listinfo/python-chinese> > _______________________________________________> python-chinese> Post: send python-chinese在lists.python.cn> Subscribe: send subscribe to python-chinese-request在lists.python.cn> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn> Detail Info: http://python.cn/mailman/listinfo/python-chinese _________________________________________________________________ MSNÊ¥µ®ÀñÎï»ðÈȵdz¡£¬Ãâ·Ñ·¢·ÅÖУ¬¿ìÀ´ÁìÈ¡°É£¡ http://im.live.cn/emoticons/?ID=18 -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080117/0cda739f/attachment.htm
2008年01月19日 星期六 07:46
"(aaa)(bbb)(ccc)".replace('(', ' ').replace(')', ' ').split() 2008/1/17 cunheise <cunheise在hotmail.com>: > > print str[1:-1].split(')(') > > > > Date: Thu, 17 Jan 2008 15:22:15 +0800 > > From: redack在gmail.com > > To: python-chinese在lists.python.cn > > Subject: Re: [python-chinese] 请问一个正则的问题 > > > > > > s[1:len(s)-1].split(')(') > > huang falls wrote: > > > Hello ! > > > > > > str="(aaa)(bbb)(ccc)" > > > > > > 想将其转成一个list : > > > > > > [ "aaa", "bbb", "ccc" ] > > > > > > 请问如何做比较合适? > > > > > > Thanks! > > > > > > Regards > > > Falls > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > ________________________________ > "七件武器,七种完美" 立刻体验! > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese >
2008年01月19日 星期六 07:47
顺便说一句,不要用str作变量名。这是py的一个内置函数的名字。 2008/1/18 shhgs <shhgs.efhilt在gmail.com>: > "(aaa)(bbb)(ccc)".replace('(', ' ').replace(')', ' ').split() > > > 2008/1/17 cunheise <cunheise在hotmail.com>: > > > > > print str[1:-1].split(')(') > > > > > > > Date: Thu, 17 Jan 2008 15:22:15 +0800 > > > From: redack在gmail.com > > > To: python-chinese在lists.python.cn > > > Subject: Re: [python-chinese] 请问一个正则的问题 > > > > > > > > > > s[1:len(s)-1].split(')(') > > > huang falls wrote: > > > > Hello ! > > > > > > > > str="(aaa)(bbb)(ccc)" > > > > > > > > 想将其转成一个list : > > > > > > > > [ "aaa", "bbb", "ccc" ] > > > > > > > > 请问如何做比较合适? > > > > > > > > Thanks! > > > > > > > > Regards > > > > Falls > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese在lists.python.cn > > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > ________________________________ > > "七件武器,七种完美" 立刻体验! > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > >
2008年01月19日 星期六 19:45
ÕýÔò±í´ïʽÖ÷Òª¿¿µ÷ÊÔ£¬ÊÔÒ»ÊÔÕâ¸ö£ºhttp://code.google.com/p/qre/ 2008/1/17 huang falls <falls1977在gmail.com>: > Hello £¡ > > str="(aaa)(bbb)(ccc)" > > Ï뽫Æäת³ÉÒ»¸ölist : > > [ "aaa", "bbb", "ccc" ] > > ÇëÎÊÈçºÎ×ö±È½ÏºÏÊÊ£¿ > > Thanks! > > Regards > Falls > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080119/294c4a29/attachment.html
Zeuux © 2024
京ICP备05028076号