title: Merge csv files using python without repeating header
body: <p>I am trying to do this ,</p>
  
  <pre><code>import glob
  
  interesting_files = glob.glob("/home/tcs/PYTHONMAP/test1/*.csv") 
  
  header_saved = False
  with open('/home/tcs/PYTHONMAP/output.csv','wb') as fout:
      for filename in interesting_files:
          with open(filename) as fin:
              header =  next(fin)
              if not header_saved:
                  fout.write(header)
                  header_saved = True
              for line in fin:
                  fout.write(line)
  </code></pre>
  
  <p>and getting </p>
  
  <pre><code>File "/home/tcs/.config/spyder-py3/temp.py", line 11, in &lt;module&gt;
      fout.write(header)
  
  TypeError: a bytes-like object is required, not 'str'
  </code></pre>
  
  <p>I don't know much about python please help
  Also i want to know how to split 1 big csv into multiple csv with same header.</p>