Good programming style

Astley Le Jasper Astley.lejasper at
Fri Sep 12 12:08:33 CEST 2008

I'm still learning python and would like to know what's a good way of
organizing code.

I am writing some scripts to scrape a number of different website that
hold similar information and then collating it all together. Obviously
each site needs to be handled differently, but once the information is
collected then more generic functions can be used.

Is it best to have it all in one script or split it into per site
scripts that can then be called by a manager script? If everything is
in one script would you have per site functions to extract the data or
generic function that contain vary slightly depending on the site, for

import firstSiteScript
import secondSiteScript

firstsitedata = firstSiteScript.getData('search_str)
secondsitedata = secondSiteScript.getData('search_str)
etc etc


def getFirstSiteData(search_str):
  etc etc
def getSecondSiteData(search_str):
  etc etc


def getdata(search_str, website):
  if website == 'firstsite':
  elif website =='secondsite':


More information about the Python-list mailing list