M
micron_make
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 regex and return a
dictionary. What I am looking for is (pseudo code)
for line in file:
re.search("pattern1" OR "pattern2" OR ..,line)
and the result should be {pattern1:match, pattern2:match...}
Also should I be using regex at all here ?
-rohit
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 regex and return a
dictionary. What I am looking for is (pseudo code)
for line in file:
re.search("pattern1" OR "pattern2" OR ..,line)
and the result should be {pattern1:match, pattern2:match...}
Also should I be using regex at all here ?
-rohit