Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5e4e39f

Browse files
author
Skip Montanaro
committed
Note that csv files (when they are actual files) must be opened in 'b'inary
mode. Note that the only restriction on the csvfile passed to writer objects is that it have a write method.
1 parent 774816f commit 5e4e39f

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

Doc/lib/libcsv.tex

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ \subsection{Module Contents}
5454
Return a reader object which will iterate over lines in the given
5555
{}\var{csvfile}. \var{csvfile} can be any object which supports the
5656
iterator protocol and returns a string each time its \method{next}
57-
method is called. An optional \var{dialect} parameter can be given
57+
method is called. If \var{csvfile} is a file object, it must be opened with
58+
the 'b' flag on platforms where that makes a difference. An optional
59+
{}\var{dialect} parameter can be given
5860
which is used to define a set of parameters specific to a particular CSV
5961
dialect. It may be an instance of a subclass of the \class{Dialect}
6062
class or one of the strings returned by the \function{list_dialects}
@@ -71,7 +73,10 @@ \subsection{Module Contents}
7173
\begin{funcdesc}{writer}{csvfile\optional{,
7274
dialect=\code{'excel'}\optional{, fmtparam}}}
7375
Return a writer object responsible for converting the user's data into
74-
delimited strings on the given file-like object. An optional
76+
delimited strings on the given file-like object. \var{csvfile} can be any
77+
object with a \function{write} method. If \var{csvfile} is a file object,
78+
it must be opened with the 'b' flag on platforms where that makes a
79+
difference. An optional
7580
{}\var{dialect} parameter can be given which is used to define a set of
7681
parameters specific to a particular CSV dialect. It may be an instance
7782
of a subclass of the \class{Dialect} class or one of the strings
@@ -125,7 +130,7 @@ \subsection{Module Contents}
125130
added as a sequence keyed by the value of \var{restkey}. If the row read
126131
has fewer fields than the fieldnames sequence, the remaining keys take the
127132
value of the optiona \var{restval} parameter. All other parameters are
128-
interpreted as for regular readers.
133+
interpreted as for \class{reader} objects.
129134
\end{classdesc}
130135

131136

@@ -143,7 +148,7 @@ \subsection{Module Contents}
143148
\var{extrasaction} parameter indicates what action to take. If it is set
144149
to \code{'raise'} a \exception{ValueError} is raised. If it is set to
145150
\code{'ignore'}, extra values in the dictionary are ignored. All other
146-
parameters are interpreted as for regular writers.
151+
parameters are interpreted as for \class{writer} objects.
147152
\end{classdesc}
148153

149154
\begin{classdesc*}{Dialect}{}

0 commit comments

Comments
 (0)