Using stdout.write instead of print