Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. #!/usr/bin/python3
  2. files = ['../BigInteger.h', '../Finite.h', '../Rational.h', '../Matrix.h']
  3. read_files = []
  4. for f in files:
  5.     read_files.append(open(f).readlines())
  6. includes = set()
  7. for i in read_files:
  8.     for line in i:
  9.         if line[0] == '#': includes.add(line)
  10. output = open('matrix.h', 'w')
  11. for i in includes:
  12.     if i.startswith('#include') and not i.count('"'):
  13.         print(i, file=output, end='')
  14.  
  15. for f in read_files:
  16.     for line in f:
  17.         if line[0] != '#':
  18.             print(line, file=output, end='')
  19.  
  20. output.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement