Ant wrote:
> Is it worth me submitting a patch to fileinput which can take an
> optional write mode parameter?
absolutely.
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> Ant wrote:
...
> > filehandle.write("xxx \n")
> > filehandle.write("xxx \x0a")
> >
> > and all of these give me a nice windows-style crlf!
> >
> > Surely there must be a way to do this ...
>
> and there is: open your output file in binary mode; then it won't
> convert every \
Ant wrote:
> Larry Bates wrote:
>
> > Ant wrote:
> ...
> > > Is there any way of doing this without having to post-process the file
> > > in binary mode (a-la the crlf.py script)
> ...
> > You can write to a new file and create your own line endings.
> > When done, delete the original file and ren
Ant wrote:
> How can I create my own line endings? I've tried setting os.linesep =
> "\n", (and to \x0a). I've tried things like:
>
> print "xxx yyy \n",
> print "xxx uuu \x0a",
> filehandle.write("xxx \n")
> filehandle.write("xxx \x0a")
>
> and all of these give me a nice windows-style crlf!
>
Larry Bates wrote:
> Ant wrote:
...
> > Is there any way of doing this without having to post-process the file
> > in binary mode (a-la the crlf.py script)
...
> You can write to a new file and create your own line endings.
> When done, delete the original file and rename the output file.
How ca
Ant wrote:
> Hi all,
>
> I've got a problem here which has me stumped. I've got a python script
> which does some text processing on some files and writes it back out to
> the same file using the fileinput module with inplace set to True.
>
> The script needs to run from Windows, but the files ne
Hi all,
I've got a problem here which has me stumped. I've got a python script
which does some text processing on some files and writes it back out to
the same file using the fileinput module with inplace set to True.
The script needs to run from Windows, but the files need to be written
with Uni