title: python convert pdf files to eps
body: <p>hello I have many pdf files and I eant to convert to .eps using python.</p>
  
  <p>I have find some codes but don't work for me that codes execute without some error but I don't take some .eps file .</p>
  
  <p>any idea ?</p>
  
  <p>I have python 2.7.13</p>
  
  <p>code 1 :</p>
  
  <pre><code>from glob import *
  from os import system
  fileList = glob('*.pdf')
  for f in fileList:
    system('pdftops -eps {0}'.format(f))
  </code></pre>
  
  <p>code 2 :</p>
  
  <pre><code>import os, re, sys 
  dirList = os.listdir( '.' )
  try:
      os.mkdir( 'EpsFigs' )
  except:
      pass
  for f in dirList:
      m = re.match('([\w\-]+).(|jpg|jp2|png|pdf|)$',f)
      if m:
          cmd = 'convert %s EpsFigs/%s.eps'%( f, m.group(1) )
          os.system(cmd)
  </code></pre>