tvaLib
crawl.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # tvaLib Copyright (c) 2012-2016 Paul G. St-Aubin
3 # Ecole Polytechnique de Montreal, McGill University
4 # Python 2.7; (dt) Spyder Windows 10 64-bit; ipython Ubuntu 15.04 64-bit
5 
6 import os
7 
8 path='.'
9 
10 subdirs = [x[0] for x in os.walk(path)]
11 for subdir in subdirs:
12  files = os.walk(subdir).next()[2]
13  if (len(files) > 0):
14  for file in files:
15  if(file == 'report.tex'):
16  with open(os.path.join(subdir,file), 'r') as fin:
17  tex_markup = fin.read().splitlines()
18  tex_subdir = subdir.replace('\\', '/').replace('./', '')
19 
20  print '\graphicspath{ {'+tex_subdir+'/},{'+tex_subdir+'/../} }'
21  #for i in range(16,34):
22  print "\\begin{center}"
23  for i in range(17,33):
24  print tex_markup[i]
25  print "\\end{center}"
26 
27  #print stuff between pages here
28  print '\\newpage'