Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78084
| References | <mailman.14114.1411063879.18130.python-list@python.org> <541bc310$0$29975$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmpRnN3FaT2EHiFFuMBOArVBuuvf+f4siex95SW6vPGdcQ@mail.gmail.com> <CALwzidnTwOgLwt1WGs+oqgCfPtB2hc5NgV4KDMZ4xSx5YRXnuA@mail.gmail.com> |
|---|---|
| Date | 2014-09-20 03:36 +1000 |
| Subject | Re: program to generate data helpful in finding duplicate large files |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14151.1411148195.18130.python-list@python.org> (permalink) |
On Sat, Sep 20, 2014 at 3:20 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > On Fri, Sep 19, 2014 at 12:45 AM, Chris Angelico <rosuav@gmail.com> wrote: >> On Fri, Sep 19, 2014 at 3:45 PM, Steven D'Aprano >>> s = '\0'.join([thishost, md5sum, dev, ino, nlink, size, file_path]) >>> print s >> >> That won't work on its own; several of the values are integers. So >> either they need to be str()'d or something in the output system needs >> to know to convert them to strings. I'm inclined to the latter option, >> which simply means importing print_function from __future__ and >> setting sep=chr(0). > > Personally, I lean toward converting them with map in this case: > > s = '\0'.join(map(str, [thishost, md5sum, dev, ino, nlink, size, > file_path])) There are many ways to do it. I'm not seeing this as particularly less ugly than the original formatting code, tbh, but it does work. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
program to generate data helpful in finding duplicate large files David Alban <extasia@extasia.org> - 2014-09-18 11:11 -0700
Re: program to generate data helpful in finding duplicate large files Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-19 15:45 +1000
Re: program to generate data helpful in finding duplicate large files Chris Angelico <rosuav@gmail.com> - 2014-09-19 16:45 +1000
Re: program to generate data helpful in finding duplicate large files Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-19 21:04 +1000
Re: program to generate data helpful in finding duplicate large files Chris Angelico <rosuav@gmail.com> - 2014-09-19 21:36 +1000
Re: program to generate data helpful in finding duplicate large files Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-20 09:33 +1000
Re: program to generate data helpful in finding duplicate large files Chris Angelico <rosuav@gmail.com> - 2014-09-20 14:47 +1000
Re: program to generate data helpful in finding duplicate large files Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-19 11:20 -0600
Re: program to generate data helpful in finding duplicate large files Chris Angelico <rosuav@gmail.com> - 2014-09-20 03:36 +1000
csiph-web