Package csb :: Package io :: Class EntryWriter |
[frames] | no frames]

# Class EntryWriter

source code

    object --+
             |
            EntryWriter

A simple stream writer. The best way to use it is:

       with EntryWriter(output_file, close=True) as out:
           out.write(object)

In this way the stream is automatically closed at the end of the block.

Instance Methods
__del__(self) | source code
__enter__(self) | source code
__exit__(self, exc_type, exc_value, traceback) | source code
__init__(self, destination, close=True, newline=`'``\n``'`) x.__init__(...) initializes x; see help(type(x)) for signature | source code
close(self) Close the destination stream. | source code
write(self, data) Write a chunk of sting data to the destination stream. | source code
writeall(self, entries, delimiter=`'``\n``'`) Write all `entries` to the destination stream, separating them with `delimiter` | source code
writeline(self, data) Same as `write`, but appends a newline character at the end. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
| autoclose
| newline
stream | stream Destination stream
Inherited from `object`: `__class__`

Method Details

### __init__(self, destination, close=True, newline=`'``\n``'`) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Parameters: `destination` (str or stream) - output file name or opened stream `newline` (str) - new line string (the default is csb.io.NEWLINE) `close` (bool) - if True (the default), the stream is automatically closed when the object is destroyed Overrides: object.__init__ (inherited documentation)

### writeall(self, entries, delimiter=`'``\n``'`) | source code
Write all `entries` to the destination stream, separating them with `delimiter` Parameters: `entries` (iterable) - a collection of objects `delimiter` (str) - append this string after each entry (the default is a `self.newline` character)

Property Details

### autoclose Get Method: unreachable.autoclose(self) Set Method: unreachable.autoclose(self, value)

### newline Get Method: unreachable.newline(self) Set Method: unreachable.newline(self, value)

### stream Destination stream Get Method: unreachable.stream(self) - Destination stream Type: stream