program to generate data helpful in finding duplicate large files
steve+comp.lang.python at pearwood.info
Fri Sep 19 13:04:39 CEST 2014
Chris Angelico wrote:
> On Fri, Sep 19, 2014 at 3:45 PM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> 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.
Ah, so they are!
> 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).
>>> *exit( 0 )*
>> No need to explicitly call sys.exit (just exit won't work) at the end of
>> your code.
> Hmm, you sure exit won't work?
In the interactive interpreter, exit is bound to a special helper object:
Use exit() or Ctrl-D (i.e. EOF) to exit
Otherwise, you'll get NameError.
> I normally use sys.exit
Like I said, sys.exit is fine :-)
Of course you can "from sys import exit", or "exit = sys.exit", but the OP's
code didn't include either of those.
More information about the Python-list