Thanks for that.
There won't always be only 1 space on either side though.
My output looks something like this:
>>> s=' MyText (mymessage): 100 (Time 2000 hours)'
>>> pattern = re.compile(r':( .*?)\(')
>>> pattern.findall (s)
[' 100 ']
How do I get rid of the annoying [' and '] ?
I want to be able to say, x=100,...
User Profile
Collapse
-
Hello,
Thanks for the reply.
This is my regexp:
s=' MyText (mymessage): 1000 (Time 2000 hours)'
pattern = re.compile(r':( .*?)\(')
pattern.findall (s)
I'm still playing with the pattern to try and figure out how the whole thing works.
CheersLeave a comment:
-
That output from my "re" did not post right, there are white spaces before the first quote and the 0.Leave a comment:
-
Find a number between 2 regular expressions
Hello,
I'm pretty new to Python.
Can someone please show me how to find a number between 2 regular expressions?
Something like this:
Text:
' MyText (mymessage): 0 (Time 0 hours)'
' MyText (mymessage): 344 (Time 34 hours)'
' MyText (mymessage): 1000 (Time 2000 hours)'
I'd like to "grep" for:...
No activity results to display
Show More
Leave a comment: