View Single Post
Old May 26th, 2006, 9:47 AM   #198
zem52887
Hobbyist Programmer
 
Join Date: May 2006
Posts: 127
Rep Power: 3 zem52887 is on a distinguished road
Quote:
Originally Posted by Arevos
Hm. If I have time, I'll take a look at that tomorrow.

Yes... Though you'd need to use findNextSibling or something like that in order to match the company URL to it's ticker-tape symbol.

Something like:
sibling = a.findNextSibling("a")

if sibling and "q?s" in sibling['href']:
   is_public = True

...

return company_url, is_public

The above code demonstrates how to return two values, rather than one. The code below shows you how to get the values from the function:

company_url, is_public = some_function()
Hey Arevos, I'm trying to reconcile this code and I'm a bit confused. When we return those two value, how do we incoroporate them in order to output them into the eventual HTML documen that we're trying to create.

Also, I've been reading through the tutorial trying to figure out the output function you posted so each piece of data goes into one particular cell.

For reference:

Quote:
I'll show you what I mean:

Code:
output = "<tr>\n"

# ... stuff to get fhighlights ...

output += "<td>" + fhighlights + "</td>\n"

# ... rest of function ...

output += "</tr>"

return output
Currently my code has one output value that looks like the following:
output = [name, companyprofile, contacttable, z, keypeople] 
        return output

If I want to be able to take each of those pieces of data and format them into a table similar to the excel spreadsheet, do I need an output statement after each #, (that being #Key People, #Company Address etc.) and if that's the case, then does "output +=" add to the previous output value?
zem52887 is offline   Reply With Quote