Newbie question about strings

K

Khalid Sheikh

Hi,

I have been tasked to Integrate Inktomi Search (now Verity of course)
with our website. I am fairly new to Python. The way the search
engine is setup is that it has embedded python in a html document.
After looking at the html code for a day or so, I was able to pin
point the place where I need to make a change but I am having a hard
time.

I am assuming

&$self.text(dbcol[docdb].pretty_name);

prints something in HTML but I am trying to figure out it's
equivalent
in Python. I am assuming this is a string and I need to check it's
value against another string say 'XXY' if it is equal then go ahead
and print that value otherwise skip to the next item in the
list/array.


This is what I had before and it worked

<!--$
first = 1
for docdb in docdbs:
if not dbcol.has_key(docdb): continue
if first: first = 0; --> <!--$
else: -->, <!--$
-->Test< &$self.text(dbcol[docdb].pretty_name); >Test<!--$
if not first: -->

when run this prints

Test< XXY >Test, Test< ABCD >Test

I want it to print only when the string is equal to XXY. otherwise
skip to the next string. This is the edited code that I have so far.


<!--$
first = 1
for docdb in docdbs:
if not dbcol.has_key(docdb): continue
if first: first = 0; --> <!--$
else: -->, <!--$
# my code
if dbcol[docdb] == <spider.Collection 'pc'> --> <!--$
# end of my code
-->Test< &$self.text(dbcol[docdb].pretty_name); >Test<!--$
if not first: -->


I get the following error when I run the program.

exceptions.SyntaxError: invalid syntax (line 86)
Line 86
if dbcol[docdb] == <spider.Collection 'pc'> wlines.append(u' ');

Any help would be greatly appreciated.

Khalid J. Sheikh
Software Engineer
Silvaco International
http://www.silvaco.com
(408) 654-4352
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top