Thanks for getting me started nelz, I'll be using that a lot in the future.

I did a little bit more digging though since the perl diamond operator can do a little bit more than this code.
i.e. it will read each file given as an argument to the program and process each file in turn. Much more useful than that though is that it can read input from stdin or a pipe.

Python doesn't have the equivalent of the Perl <> operator but it's easy enough to reproduce it. Here's a simple cat program written in Python which supports multiple filenames on the command line and '-' for stdin.