Hey all,

I have a search:

VAR = re.search("PROVEN.*?\n[\sA-Za-z\(\)\/\-]+\d(.*?)\n.*?" , pcpT9, re.S 
).group(1)  #.split()[1]

that does not match (sometimes it will and sometimes it will not match)

Traceback (most recent call last):
  File "P:\Burke\TRACKERS\Ortho-McNeil\Automation\Wave3\test.py", line 53, in ?
    VAR = re.search("PROVEN.*?\n[\sA-Za-z\(\)\/\-]+\d(.*?)\n.*?" , pcpT9, re.S 
).group(1)  #.split()[1]
AttributeError: 'NoneType' object has no attribute 'group'


Is there a way in python to make this "non" match equal a value (say, "0")?

This one line is actually a series of searches

Reasons = ["EFFICACY","EFFECTIVE","WORKS 
QUICKLY","PROVEN","SAFETY","LITTLE","WELL","  BETTER","SAMPLES"] # Reasons(29)
VAR = [re.search(r"%s.*?\n[\sA-Za-z\(\)\/\-]+\d(.*?)\n.*?" % i, pcpT9, re.S 
).group(1) for i in Reasons ]  #.split()[1]

and one of the items in the array may or may not be present.

Lance
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to