walterbyrd wrote:
I have about 150 unix formated text files that I would like to convert
to dos formated.

I am guessing that I loop though each file in the directory, read each
line and conver the last character, then save to a file with the same
name in another directory.

I am not really sure what I convert the last charactor to.

The quickest and OS-agnostic way would be:

    text = open(path, "U").read()
    text = text.replace("\n", "\r\n")
    open(path, "wb").write(text)

That way it doesn't matter if the text file is already dos formatted.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to