Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / csv-fmt-params.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="node634.html" />
13<link rel="prev" href="csv-contents.html" />
14<link rel="parent" href="module-csv.html" />
15<link rel="next" href="node634.html" />
16<meta name='aesop' content='information' />
17<title>12.20.2 Dialects and Formatting Parameters</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="12.20.1 Module Contents"
25 href="csv-contents.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="12.20 csv "
28 href="module-csv.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="12.20.3 Reader Objects"
31 href="node634.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="csv-contents.html">12.20.1 Module Contents</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="module-csv.html">12.20 csv </A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="node634.html">12.20.3 Reader Objects</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION00142020000000000000000"></A><A NAME="csv-fmt-params"></A>
56<BR>
5712.20.2 Dialects and Formatting Parameters
58</H2>
59
60<P>
61To make it easier to specify the format of input and output records,
62specific formatting parameters are grouped together into dialects. A
63dialect is a subclass of the <tt class="class">Dialect</tt> class having a set of specific
64methods and a single <tt class="method">validate()</tt> method. When creating <tt class="class">reader</tt>
65or <tt class="class">writer</tt> objects, the programmer can specify a string or a subclass
66of the <tt class="class">Dialect</tt> class as the dialect parameter. In addition to, or
67instead of, the <var>dialect</var> parameter, the programmer can also specify
68individual formatting parameters, which have the same names as the
69attributes defined below for the <tt class="class">Dialect</tt> class.
70
71<P>
72Dialects support the following attributes:
73
74<P>
75<dl><dt><b><tt id='l2h-4230' xml:id='l2h-4230' class="member">delimiter</tt></b></dt>
76<dd>
77A one-character string used to separate fields. It defaults to <code>','</code>.
78</dl>
79
80<P>
81<dl><dt><b><tt id='l2h-4231' xml:id='l2h-4231' class="member">doublequote</tt></b></dt>
82<dd>
83Controls how instances of <var>quotechar</var> appearing inside a field should be
84themselves be quoted. When <tt class="constant">True</tt>, the character is doubled.
85When <tt class="constant">False</tt>, the <var>escapechar</var> must be a one-character string
86which is used as a prefix to the <var>quotechar</var>. It defaults to
87<tt class="constant">True</tt>.
88</dl>
89
90<P>
91<dl><dt><b><tt id='l2h-4232' xml:id='l2h-4232' class="member">escapechar</tt></b></dt>
92<dd>
93A one-character string used to escape the <var>delimiter</var> if <var>quoting</var>
94is set to <tt class="constant">QUOTE_NONE</tt>. It defaults to <tt class="constant">None</tt>.
95</dl>
96
97<P>
98<dl><dt><b><tt id='l2h-4233' xml:id='l2h-4233' class="member">lineterminator</tt></b></dt>
99<dd>
100The string used to terminate lines in the CSV file. It defaults to
101<code>'&#92;r&#92;n'</code>.
102</dl>
103
104<P>
105<dl><dt><b><tt id='l2h-4234' xml:id='l2h-4234' class="member">quotechar</tt></b></dt>
106<dd>
107A one-character string used to quote elements containing the <var>delimiter</var>
108or which start with the <var>quotechar</var>. It defaults to <code>'"'</code>.
109</dl>
110
111<P>
112<dl><dt><b><tt id='l2h-4235' xml:id='l2h-4235' class="member">quoting</tt></b></dt>
113<dd>
114Controls when quotes should be generated by the writer. It can take on any
115of the <tt class="constant">QUOTE_*</tt> constants (see section&nbsp;<A href="csv-contents.html#csv-contents">12.20.1</A>)
116and defaults to <tt class="constant">QUOTE_MINIMAL</tt>.
117</dl>
118
119<P>
120<dl><dt><b><tt id='l2h-4236' xml:id='l2h-4236' class="member">skipinitialspace</tt></b></dt>
121<dd>
122When <tt class="constant">True</tt>, whitespace immediately following the <var>delimiter</var>
123is ignored. The default is <tt class="constant">False</tt>.
124</dl>
125
126<P>
127
128<DIV CLASS="navigation">
129<div class='online-navigation'>
130<p></p><hr />
131<table align="center" width="100%" cellpadding="0" cellspacing="2">
132<tr>
133<td class='online-navigation'><a rel="prev" title="12.20.1 Module Contents"
134 href="csv-contents.html"><img src='../icons/previous.png'
135 border='0' height='32' alt='Previous Page' width='32' /></A></td>
136<td class='online-navigation'><a rel="parent" title="12.20 csv "
137 href="module-csv.html"><img src='../icons/up.png'
138 border='0' height='32' alt='Up One Level' width='32' /></A></td>
139<td class='online-navigation'><a rel="next" title="12.20.3 Reader Objects"
140 href="node634.html"><img src='../icons/next.png'
141 border='0' height='32' alt='Next Page' width='32' /></A></td>
142<td align="center" width="100%">Python Library Reference</td>
143<td class='online-navigation'><a rel="contents" title="Table of Contents"
144 href="contents.html"><img src='../icons/contents.png'
145 border='0' height='32' alt='Contents' width='32' /></A></td>
146<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
147 border='0' height='32' alt='Module Index' width='32' /></a></td>
148<td class='online-navigation'><a rel="index" title="Index"
149 href="genindex.html"><img src='../icons/index.png'
150 border='0' height='32' alt='Index' width='32' /></A></td>
151</tr></table>
152<div class='online-navigation'>
153<b class="navlabel">Previous:</b>
154<a class="sectref" rel="prev" href="csv-contents.html">12.20.1 Module Contents</A>
155<b class="navlabel">Up:</b>
156<a class="sectref" rel="parent" href="module-csv.html">12.20 csv </A>
157<b class="navlabel">Next:</b>
158<a class="sectref" rel="next" href="node634.html">12.20.3 Reader Objects</A>
159</div>
160</div>
161<hr />
162<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
163</DIV>
164<!--End of Navigation Panel-->
165<ADDRESS>
166See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
167</ADDRESS>
168</BODY>
169</HTML>