remove whitespace while reading file
Posted: Tue Jun 12, 2018 8:03 am
It tried strip() but that does not work, how can I compress the read (html) file by removing whitespaces and carriage returns before sending ?
Code: Select all
self.chunk = 2048 with open(self.fdir+req['path'], 'rb') as html: head = self.head(req['path']) chunk = head + html.read(self.chunk - len(head)) while chunk: res.sendall(chunk) chunk = html.read(self.chunk) res.close()