I figured it out with the sample program I gave you. It was my mistake; <br>However, the same thing with same values is not working in my main program.<br><br>Here is what I am trying: The program traverses with correct values upto the if condition we just discussed; but fails to quality that if condition; instead it should qualify.<br>
<br><br> for key in dictionary:<br> m=re.search(key, url)<br> if m !=None:<br> values=dictionary[key]<br> for v in values:<br> v_array=v.split(',')<br>
Man_Param=v_array[4]<br> Opt_Param1=v_array[5]<br> Opt_Param2=v_array[6]<br> Cat=v_array[1]<br> Man_Param=re.sub(r'"(?P<dn>.*?)"','\g<dn>', Man_Param)<br>
Opt_Param1=re.sub(r'"(?P<dn>.*?)"','\g<dn>', Opt_Param1)<br> Opt_Param2=re.sub(r'"(?P<dn>.*?)"','\g<dn>', Opt_Param2)<br>
Cat=re.sub(r'"(?P<dn>.*?)"','\g<dn>', Cat)<br> Cat=re.sub(r':','_', Cat)<br> Cat=re.sub(r' ','_', Cat)<br>
print "hello..Man_Param=%s,Opt_Param1=%s, Opt_Param2=%s\n" %(Man_Param,Opt_Param1,Opt_Param2)<br> #sys.exit(1)<br> if len(Opt_Param1):<br> if len(Opt_Param2):<br>
#if (re.search(Man_Param,url) and re.search(Opt_Param1,url) and re.search(Opt_Param2,url) ):<br> print url<br> <b> if (Man_Param in url):#and (Opt_Param1 in url) and (Opt_Param2 in url): </b><br>
print "all are found..\n"<br> sys.exit(1)<br> if((int(cl) < 5000 or int(rc) == 206) and re.match(r"AS_D",Cat) ):<br>
Cat= Cat + "_cont"<br> foutname = "output" + "/" + Cat +"." + str(cnt)<br> fout =open(foutname, "a")<br>
fout.write(line)<br> fout.close<br> else:<br> print "here\n";<br> sys.exit(1)<br>
<br><br><br><br><div class="gmail_quote">On Thu, Sep 15, 2011 at 10:19 AM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Thu, Sep 15, 2011 at 2:41 PM, Sagar Neve <<a href="mailto:nevesagar@gmail.com">nevesagar@gmail.com</a>> wrote:<br>
> ./sample.py: line 9: syntax error near unexpected token `:'<br>
> ./sample.py: line 9: `if (Opt_Param2 in url): '<br>
><br>
<br>
</div>It worked for me in Python 3.2. What version of Python are you using?<br>
<br>
ChrisA<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>