Improvements to printpf, runpf, runopf and runuopf in regards to output

I realised that my earlier changes were not the best way to modify the code, so thus why I closed my earlier pull request. This commit changes printpf back to original format and modified files calling the function to open the output file with the append option (as opposed to writing binary). Changed format of the files so that the program only writes to stdout if and only if a file name is not specified. All changes made are compatible with both python 2 and python 3.