On Wed, Jun 17, 2015, at 20:23, Chris Angelico wrote:
> On Thu, Jun 18, 2015 at 7:55 AM, Paul Hubert <phbr...@gmail.com> wrote:
> > f_in = open(dafile, 'rb')
> > f_out = gzip.open('/Users/Paul/Desktop/scripts/pic.jpg.gz', 'wb')
> > f_out.writelines(f_in)
> > f_out.close()
> > f_in.close()
> 
> Are you sure you want iteration and writelines() here? I would be
> inclined to avoid those for any situation that isn't plain text. If
> the file isn't too big, I'd just read it all in a single blob and then
> write it all out at once.

Is there a reason not to use shutil.copyfileobj?
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to