[Python-es] Expresión regular

monoBOT monobot.soft en gmail.com
Vie Oct 15 21:46:48 CEST 2010


tny ... esa solución es muy inteligente ... da gusto verla  :-)


El 15 de octubre de 2010 19:43, tny <a.porrua en gmail.com> escribió:

> El vie, 15-10-2010 a las 17:33 +0100, monoBOT escribió:
> >
> > Yo usaria split seguro. algo asi:
> >
> > a='xxxxxxx*xxxxxx'
> >
> > if '*' in a:
> >     a.split('*')
> > elif '+' in a:
> >     a.split('+')
> > elif '+' in a:
> >     a.split('+')
> > elif '+' in a:
> >     a.split('+')
> >
> >
>
> Con split yo lo haría así
> a='xxxxxxx*xxxxxx'
> for signo in '*+-/':
>        resultado = a.split(signo)
>        if len(resultado)>1:
>                break # o return resultado si prefieres una función
>
>
>
> _______________________________________________
> Python-es mailing list
> Python-es en python.org
> http://mail.python.org/mailman/listinfo/python-es
> FAQ: http://python-es-faq.wikidot.com/
>



-- 
*monoBOT*
Visite mi sitio(Visit my site): monobotblog.alvarezalonso.es
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://mail.python.org/pipermail/python-es/attachments/20101015/478e61bf/attachment.html>


Más información sobre la lista de distribución Python-es