2007年09月17日 星期一 09:25
1. ÓÃ: "Öܱø| 122310980808123".split('|')[0]
2. ÓÃ: print re.search(r'.*(?=\|)', "Öܱø| 122310980808123").group()
±ø ÖÜ Ð´µÀ:
> ÏëÓÃpython×öÒ»¸öÍøÒøµÄÅúÁ¿ÁªÏµÈËÐÅÏ¢£¬Óõ½ÁËÕýÔòʽ£¬È¡³öÀ´µÄÊý¾Ý²»Õý
> È·£¬ÎÒÓÃRegexBuddy²âÊÔ¿ÉÐУ¬µ«ÔÚµ÷ÊÔʱ²»¿ÉÒÔ£¬¶øÓÃultraeditËÑË÷ʱҲ²»
> ¿ÉÒÔ£¬ÓõÄperl¼æÈÝģʽ£¬Êý¾ÝÖеÄÁªÏµÈ˸ñʽÈçÏ£º
> ££££££££££££
> Öܱø| 122310980808123
> ££££££££££££
> ÕýÔòʽ£º\S[\u4e00-\u9fa5]*\|\s £È¡¿¨Ö÷Ãû
>
> Python code:
> username = re.compile(r'\S[\u4e00-\u9fa5]*\|\s')
> username = username.search("Öܱø| 122310980808123") .group()
>
> ÔËÐнá¹ûÈ¡µÃ£ºø|
>
> Çë°ï°ï棬лл
>
> ------------------------------------------------------------------------
> ÑÅ»¢Ãâ·ÑÓÊÏä3.5GÈÝÁ¿£¬20M¸½¼þ£¡ <http://cn.mail.yahoo.com/>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
Zeuux © 2025
京ICP备05028076号