pwtools.batch.FileTemplate.write

FileTemplate.write(dct, calc_dir='calc', mode='dct')[source]

Write file self.filename (e.g. calc/0/pw.in) by replacing placeholders in the template (e.g. calc.templ/pw.in).

Parameters:
  • dct (dict) – key-value pairs, dct.keys() are converted to placeholders with self.func()

  • calc_dir (str) – the dir where to write the target file to

  • mode (str, {'dct', 'sql'}) –

    mode=’dct’: replacement values are dct[<key>]
    mode=’sql’: replacement values are dct[<key>].fileval and every
    dct[<key>] is an SQLEntry instance