add DosFile class for writing DOS files
This commit is contained in:
parent
aa4d536f5e
commit
9fc804f64f
1 changed files with 9 additions and 0 deletions
|
@ -36,6 +36,15 @@ import tempfile
|
||||||
__all__ = ['change_newlines', 'count_lines', 'temp_path']
|
__all__ = ['change_newlines', 'count_lines', 'temp_path']
|
||||||
|
|
||||||
|
|
||||||
|
class DosFile(file):
|
||||||
|
"""
|
||||||
|
Subclass of ``file`` which uses DOS line endings when writing the file.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def write(self, string):
|
||||||
|
super(DosFile, self).write(string.replace(os.linesep, '\r\n'))
|
||||||
|
|
||||||
|
|
||||||
def change_newlines(path, newline):
|
def change_newlines(path, newline):
|
||||||
"""
|
"""
|
||||||
Rewrites the file at ``path``, changing its newline character(s) to that of
|
Rewrites the file at ``path``, changing its newline character(s) to that of
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue