headers.py 459 B

12345678910111213141516
  1. import os
  2. from pathlib import Path
  3. def main(base_dir):
  4. path = Path(base_dir)
  5. target = path.joinpath('Kopfzeilen')
  6. os.makedirs(target, exist_ok=True)
  7. for filename in Path(base_dir).glob('*.csv'):
  8. with open(filename, 'r', encoding='latin-1') as frh, open(target.joinpath(filename.name), 'w', encoding='latin-1') as fwh:
  9. fwh.write(frh.readline())
  10. if __name__ == '__main__':
  11. main('C:/GlobalCube/System/OPTIMA/Export')