In [ ]:
from fileoperations.fileoperations import get_filenames_in_dir
from symbtrextras.txtextras import TxtExtras
import os
In [ ]:
symbtrs = [os.path.splitext(s)[0] for s in get_filenames_in_dir(os.path.join('..', '..', 'txt'), keyword='*.txt')[2]]
In [ ]:
for ii, symbTr in enumerate(symbtrs):
print str(ii) + ': ' + symbTr
symbtr_txt_file = os.path.join('..', '..', 'txt', symbTr + '.txt')
symbtr_mu2_file = os.path.join('..', '..', 'mu2', symbTr + '.mu2')
# Add usul row if it is not present in the first row
symbtr_csv = TxtExtras.add_usul_to_first_row(symbtr_txt_file, symbtr_mu2_file)
with open(symbtr_txt_file, 'w') as text_file:
text_file.write(symbtr_csv)