do not keep whitespaces

This commit is contained in:
Martin Diehl 2019-05-25 13:48:38 +02:00
parent 2b7d95f800
commit 9f63d768de
1 changed files with 2 additions and 1 deletions

View File

@ -73,7 +73,7 @@ class Geom():
elif line.lower().strip().startswith('homogenization'): elif line.lower().strip().startswith('homogenization'):
homogenization = int(line.split()[1]) homogenization = int(line.split()[1])
else: else:
comments.append(line[:-1]) comments.append(line.rstrip().strip())
if isinstance(fname,str): if isinstance(fname,str):
with open(fname) as f: with open(fname) as f:
@ -114,6 +114,7 @@ class Geom():
header.append('grid a {} b {} c {}'.format(*grid)) header.append('grid a {} b {} c {}'.format(*grid))
header.append('size x {} y {} z {}'.format(*self.get_size())) header.append('size x {} y {} z {}'.format(*self.get_size()))
header.append('homogenization {}'.format(self.get_homogenization())) header.append('homogenization {}'.format(self.get_homogenization()))
if self.microstructure.dtype == 'int': if self.microstructure.dtype == 'int':
format_string='%{}i'.format(int(math.floor(math.log10(self.microstructure.max())+1))) format_string='%{}i'.format(int(math.floor(math.log10(self.microstructure.max())+1)))
else: else: