[Tutor] really basic - finding multiline chunk within larger chunk
bruce
badouglas at gmail.com
Tue Feb 16 10:30:54 EST 2016
Hi.
I've got a test, where I have a chunk of text "a" and a subset of text
"s2a". the subset is multiline.
For some reason, can't seem to return true on the find. I've pasted in
http://fpaste.org/323521/, but the following is an example as well.
(not sure if the psuedo code listed actually shows the chunks of text
with the whitespace correctly.
Obviously, this is an "example" not meant to be real code!!
Thoughts on what I've screwed up?
Thanks
aa='''<TR>
<TD align="LEFT" valign="TOP"></TD>
<TD align="LEFT" valign="TOP"
class="row_SectionLite"><STRONG>Retail Price</STRONG></TD>
<TD valign="TOP" class="row_SectionLite"></TD>
<TD align="RIGHT" valign="TOP"
class="row_SectionLite">Less than $10</TD>
<TD align="RIGHT" valign="TOP"></TD>
</TR>
<TR>
<TD align="LEFT" valign="TOP"></TD>
<TD align="LEFT" valign="TOP"
class="row_SectionLite"><STRONG>Required</STRONG></TD>
<TD valign="TOP" class="row_SectionLite"></TD>
<TD align="RIGHT" valign="TOP" class="row_SectionLite">
Yes
</TD>
<TD align="RIGHT" valign="TOP"></TD>
</TR>
<TR>
<TD align="LEFT" valign="TOP"></TD>
<TD align="LEFT" valign="TOP"
class="row_SectionLite"><STRONG>Used During</STRONG></TD>
<TD valign="TOP" class="row_SectionLite"></TD>
<TD align="RIGHT" valign="TOP"
class="row_SectionLite">Full Term</TD>
<TD align="RIGHT" valign="TOP"></TD>
</TR>
<TR>
<TD align="LEFT" valign="TOP"></TD>
<TD align="LEFT" valign="TOP"
class="row_SectionLite"><STRONG>Copies on Reserve in
Libraries</STRONG></TD>
<TD valign="TOP" class="row_SectionLite"></TD>
<TD align="RIGHT" valign="TOP" class="row_SectionLite">
No
</TD>
<TD align="RIGHT" valign="TOP"></TD>
</TR>'''
-----------------------------------------------
as a test:
s2a='''<TR>
<TD align="LEFT" valign="TOP"></TD>
<TD align="LEFT" valign="TOP"
class="row_SectionLite"><STRONG>Required</STRONG></TD>
<TD valign="TOP" class="row_SectionLite"></TD>
<TD align="RIGHT" valign="TOP" class="row_SectionLite">
Yes
</TD>
<TD align="RIGHT" valign="TOP"></TD>
</TR>'''
if (aa.find(s2a)>0):
print "here ppp \n"
else:
print "errrrrr \n"
sys.exit()
More information about the Tutor
mailing list