title: AttributeError: 'unicode' object has no attribute 'write' in json.dump
body: <p>I'm using Python 2.7.14 .</p>
  
  <p>When execute this,</p>
  
  <pre><code># -*- coding: utf-8 -*-
  from __future__ import (absolute_import, division, print_function,
                          unicode_literals)
  import os
  import json
  
  def main():
      path = os.path.join(os.path.dirname(__file__), 'data-creation.json')
      with open(path, 'r+') as f:
          json_data = json.load(f)
          json.dump(json_data, path)
  
  if __name__=='__main__':
      main()
  </code></pre>
  
  <p>it says <code>AttributeError: 'unicode' object has no attribute 'write'</code> in line of <code>json.dump(json_data, path)</code> .</p>
  
  <p><code>
  nkf -g data-creation.json
  </code>
  outputs <code>ASCII</code>, but what is wrong?
  I think this is a matter of char code.</p>