SparkseePython
6.0.2
|
Public Member Functions | |
def | __init__ (self) |
Creates a new instance. | |
def | set_separator (self, sep) |
Sets the character used to separate fields in the file. More... | |
def | set_auto_quotes (self, autoquotes) |
Sets on/off the automatic quote mode. More... | |
def | open (self, f) |
Opens the output file path. More... | |
def | write (self, row) |
Writes the next row. More... | |
def | set_forced_quotes (self, forcequotes) |
Disables the automatic quote mode and forces to be quoted those positions set to TRUE in the given vector. More... | |
def | close (self) |
Closes the writer. More... | |
def | set_locale (self, locale_str) |
Sets the locale that will be used to write the file. More... | |
def | set_quotes (self, quotes) |
Sets the character used to quote fields. More... | |
CSVWriter interface.
A very simple CSV writer implementing RowWriter.
It works as any other RowWriter, but open must be called once before the first write operation.
It uses the format RFC 4180: http://tools.ietf.org/html/rfc4180
You can use your own separators and quote characters. By default the separator is the comma (,) and the quote character is the double quotes (") and autoquote is enabled.
See the CSVReader locale documentation or the SPARKSEE User Manual.
Check out the 'Data export' section in the SPARKSEE User Manual for more details on this.
def sparksee.CSVWriter.close | ( | self | ) |
Closes the writer.
RuntimeError | null |
IOError | If the close fails. |
def sparksee.CSVWriter.open | ( | self, | |
f | |||
) |
Opens the output file path.
f | [in] Output file path. |
IOError | If bad things happen opening the file. |
def sparksee.CSVWriter.set_auto_quotes | ( | self, | |
autoquotes | |||
) |
Sets on/off the automatic quote mode.
If there are forced quotes, setting autoquotes on will clear them. If the autoquotes is set to off and no forced quotes are provided, there will not be any quote.
autoquotes | [in] If TRUE it enables the automatic quote mode, if FALSE it disables it. |
def sparksee.CSVWriter.set_forced_quotes | ( | self, | |
forcequotes | |||
) |
Disables the automatic quote mode and forces to be quoted those positions set to TRUE in the given vector.
forcequotes | [in] A booleanList with the position for each column that must be quoted set to true. |
def sparksee.CSVWriter.set_locale | ( | self, | |
locale_str | |||
) |
Sets the locale that will be used to write the file.
locale_str | [in] The locale string for the file encoding. |
def sparksee.CSVWriter.set_quotes | ( | self, | |
quotes | |||
) |
Sets the character used to quote fields.
quotes | [in] Quote character. |
RuntimeError | null |
def sparksee.CSVWriter.set_separator | ( | self, | |
sep | |||
) |
Sets the character used to separate fields in the file.
sep | [in] Separator character. |
RuntimeError | null |
def sparksee.CSVWriter.write | ( | self, | |
row | |||
) |
Writes the next row.
row | [in] Row of data. |
RuntimeError | null |
IOError | If bad things happen during the write. |