[orbit-user] orbit-user Digest, Vol 4, Issue 7

Rodney Berriman rodney.berriman at nicta.com.au
Tue Apr 29 18:57:20 EDT 2008


import re
p = re.compile('=(\d+)')
example="x=123 y=234"
a = p.findall(example)
print "x is: " + a[0] + ", y is: " + a[1]

ref: http://www.amk.ca/python/howto/regex/

Rodney
NICTA, Sydney


orbit-user-request at orbit-lab.org wrote:
> Send orbit-user mailing list submissions to
> 	orbit-user at orbit-lab.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://orbit-lab.org/cgi-bin/mailman/listinfo/orbit-user
> or, via email, send a message with subject or body 'help' to
> 	orbit-user-request at orbit-lab.org
>
> You can reach the person managing the list at
> 	orbit-user-owner at orbit-lab.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of orbit-user digest..."
>   
> ------------------------------------------------------------------------
>
> Today's Topics:
>
>    1. How does Python Regular Expressions work? (zanb at eden.rutgers.edu)
>   
>
> ------------------------------------------------------------------------
>
> Subject:
> [orbit-user] How does Python Regular Expressions work?
> From:
> zanb at eden.rutgers.edu
> Date:
> Mon, 28 Apr 2008 15:42:16 -0400 (EDT)
> To:
> "Orbit user discussion mailing list" <orbit-user at orbit-lab.org>
>
> To:
> "Orbit user discussion mailing list" <orbit-user at orbit-lab.org>
>
>
> Hi,
>   Anyone has some experience on Python regular expression?
>   I have a buf output something like "x=132 y=321 z=123", how can I get
> the value 132, 321, 123, and put into other variables using python?
> Thank you.
>
> Bin Zan
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> orbit-user mailing list
> orbit-user at orbit-lab.org
> http://orbit-lab.org/cgi-bin/mailman/listinfo/orbit-user
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://orbit-lab.org/pipermail/orbit-user/attachments/20080430/0be8d501/attachment.htm>


More information about the orbit-user mailing list