X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=tableau.py;fp=tableau.py;h=1be437ba2f8bb14478616eece7e8a6715a005e33;hb=af8c3ff85a3c867356cb6353ca0e9bfe414d5b76;hp=732527910790b3c1f68741fefb35427419faac47;hpb=e6f6318b1ab077a97c10559b3323ccf158ae6203;p=iramuteq diff --git a/tableau.py b/tableau.py index 7325279..1be437b 100644 --- a/tableau.py +++ b/tableau.py @@ -211,7 +211,7 @@ class Tableau() : self.linecontent = [[val.replace('"','').replace(';',' ').replace('\t', ' ').strip() for val in line] for line in self.linecontent] def write_csvfile(self) : - with open(self.parametres['csvfile'], 'w') as f : + with open(self.parametres['csvfile'], 'w', encoding='utf8') as f : f.write('\n'.join(['\t'.join(line) for line in self.csvtable])) def make_tmpfile(self) : @@ -237,7 +237,7 @@ class Tableau() : self.write_csvfile() def read_csvfile(self): - with codecs.open(self.parametres['csvfile'], 'r', self.parametres['syscoding']) as f: + with open(self.parametres['csvfile'], 'r', encoding='utf8') as f: self.csvtable = [line.split('\t') for line in f.read().splitlines()] self.linecontent = [line[1:] for line in self.csvtable] self.linecontent.pop(0) @@ -301,7 +301,7 @@ class Tableau() : #out = [[self.rownames[i]] + out[i] for i in range(len(linecontent))] #out.insert(0,[self.idname] + self.listactives) out.insert(0, self.listactives) - with open(fileout, 'w') as f : + with open(fileout, 'w', encoding='utf8') as f : f.write('\n'.join([';'.join(line) for line in out])) def make_01_from_selection(self, listact, listsup = None, dowrite = True) : @@ -329,15 +329,15 @@ class Tableau() : #table = [[self.rownames[i]] + table[i] for i in range(len(self.rownames))] #table.insert(0, [self.idname] + self.listactives) table.insert(0, self.listactives) - with open(fileout, 'w') as f: + with open(fileout, 'w', encoding='utf8') as f: f.write('\n'.join([';'.join(line) for line in table])) def printtable(self, filename, Table, sep = ';'): - with open(filename, 'w') as f : + with open(filename, 'w', encoding='utf8') as f : f.write('\n'.join([sep.join(line) for line in Table])) def buildprofil(self) : - with open(self.pathout['uce'], 'r') as filein : + with open(self.pathout['uce'], 'r', encoding='utf8') as filein : content = filein.readlines() content.pop(0) lsucecl = []