Learn the modern way to write files in Python with proper newline handling and replace deprecated print >>f syntax.