3 ms·
The first script does not work on Python 3. That's the whole point of the post. You need to use the second one.
by the_mitsuhiko 13y ago
The first script does not work on Python 3. That's the whole point of the post. You need to use the second one.
- e12e 13y agoWell, the first script works if you don't open the files as binary files (see my "patch") -- and if you don't you get a sane error when you try to open a binary file. So they're different, but I still say it's not so clear that one is broken, one is not. I'm also not clear where all the comments on filenames comes from, but maybe they just happen to work in my case? [edit: see my other comment on treating stdin/out as binary from python3]
- DasIch 13y agoIf you don't open the files as binary, the script doesn't do what it's supposed to.
- e12e 13y agofrom the manpage of cat(1) my emphasis: "cat - concatenate files and print on the standard output" Cat has quite a few options that clearly deal with text files: --number-nonblank, --show-ends, --number, -show-tabs, --show-nonprinting, --squeeze-blank ... BSD cat[1] is a little more conservative, but it's not entirely clear cut that when printing to standard output (or reading from standard input) you want binary mode. And silently copying a binary stream to a text stream does sound like a bug. Even if that is the expected behaviour of standard "cat". [1] http://www.freebsd.org/cgi/man.cgi?cat(1) http://www.freebsd.org/cgi/man.cgi?cat(1)