each of the suggested methods fit in. I have started trying them.
-Rohit
--
View this message in context:
http://www.nabble.com/multiple-pattern-regular-expression-tp16895148p16936657.html
Sent from the Python - python-list mailing list archive at Nabble.com.
--
http://mail.python.org/mailma
Chris Henry <[EMAIL PROTECTED]> writes:
> On Apr 25, 8:37 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>> micron_make <[EMAIL PROTECTED]> writes:
>> > I am trying to parse a file whose contents are :
>>
>> > parameter=current
>> > max=5A
>> > min=2A
> [snip]
>> If every line of the file is of t
On Apr 25, 8:37 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> micron_make <[EMAIL PROTECTED]> writes:
> > I am trying to parse a file whose contents are :
>
> > parameter=current
> > max=5A
> > min=2A
[snip]
> If every line of the file is of the form name=value, then regexps are
> indeed not ne
On Fri, Apr 25, 2008 at 08:40:55PM -0400, Carsten Haese wrote:
> Nick Stinemates wrote:
>> On Fri, Apr 25, 2008 at 09:50:56AM -0400, [EMAIL PROTECTED] wrote:
>>> How about this?
>>>
>>> for line in file:
>>> # ignore lines without = assignment
>>> if '=' in line:
>>> property, value
Nick Stinemates wrote:
On Fri, Apr 25, 2008 at 09:50:56AM -0400, [EMAIL PROTECTED] wrote:
How about this?
for line in file:
# ignore lines without = assignment
if '=' in line:
property, value = line.strip().split( '=', 1 )
property = property.strip().lower()
valu
On Fri, Apr 25, 2008 at 09:50:56AM -0400, [EMAIL PROTECTED] wrote:
> How about this?
>
> for line in file:
> # ignore lines without = assignment
> if '=' in line:
> property, value = line.strip().split( '=', 1 )
> property = property.strip().lower()
> value = value.
How about this?
for line in file:
# ignore lines without = assignment
if '=' in line:
property, value = line.strip().split( '=', 1 )
property = property.strip().lower()
value = value.strip()
# do something with property, value
Malcolm
--
http://mail.python
Arnaud Delobelle wrote:
micron_make <[EMAIL PROTECTED]> writes:
I am trying to parse a file whose contents are :
parameter=current
max=5A
min=2A
for a single line I used
for line in file:
print re.search("parameter\s*=\s*(.*)",line).groups()
is there a way to match multiple patt
micron_make <[EMAIL PROTECTED]> writes:
> I am trying to parse a file whose contents are :
>
> parameter=current
> max=5A
> min=2A
>
> for a single line I used
> for line in file:
> print re.search("parameter\s*=\s*(.*)",line).groups()
>
> is there a way to match multiple patterns using reg