Used Python 2 syntax

Used Python 2 syntax for the file writing