View Single Post
Old May 24th, 2006, 9:29 AM   #146
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Hm. You could make some new functions, yes. Might be a good idea. You can call them from the get_company_data function. Perhaps something like:
def get_company_data(company_url):
	soup = BeautifulSoup(urlopen(company_url))

	profile_table = get_company_profile_table(soup)
	company_name = get_company_name(profile_table)
	# ...etc...

	contactinfo_table = get_company_contact_information(soup)
	address = get_company_address(contactinfo_table)
	# ...more of the same...

	return [company_name, address, ...]
Or you could create one big function. It's easier to work with smaller functions as a rule, however.

Remember that you need to get the information into a state in which you can make a spreadsheet out of it. It's no good just having the table that contains the contact information; you have to pull the company name, the address and so forth from it.

I your original post lists five piece of data:

1) name
2) description
3) address
4) financial highlights (if there)
5) key people

You need to pull these out of the tables you've found so that you can construct the spreadsheet to import into Excel.
Arevos is offline   Reply With Quote