[Graham Nicholls] > Is there an equivalent of [ -f $filename ] to test for the existence > of filename in Python? Try os.path.exists(filename). If in addition you care whether it's a directory or non-directory file, isdir() or isfile() instead. These are convenience functions wrapping os.stat(filename).