python 3 compatability

Mostly just adding parens to print statements but also using the python 3 version of printing to files.