title: How to write an output of a command to stdout and a file in Python3?
body: <p>I have a Windows command which I want to write to stdout and to a file. For now, I only have <code>0</code> string writen in my file:</p>
  
  <pre><code>#!/usr/bin/env python3
  #! -*- coding:utf-8 -*-
  
  import subprocess
  
  with open('auto_change_ip.txt', 'w') as f:
      print(subprocess.call(['netsh', 'interface', 'show', 'interface']), file=f)
  </code></pre>