/usr/share/doc/pyxplot/html/sec-stringvars.html is in pyxplot-doc 0.9.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: Strings</title>
<link href="sec-stringsubop.html" title="The string substitution operator" rel="next" />
<link href="sect0036.html" title="Instantiating objects" rel="prev" />
<link href="chap-progDataTypes.html" title="Programming: Pyxplot’s data types" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0036.html" title="Instantiating objects"><img alt="Previous: Instantiating objects" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="chap-progDataTypes.html" title="Programming: Pyxplot’s data types"><img alt="Up: Programming: Pyxplot’s data types" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sec-stringsubop.html" title="The string substitution operator"><img alt="Next: The string substitution operator" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sect0001.html">Introduction to PyXPlot</a> <b>:</b>
</span>
</span><span>
<span>
<a href="chap-progDataTypes.html">Programming: Pyxplot’s data types</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">Strings</b>
</span>
</span>
<hr />
</div>
<div><h1 id="sec:stringvars">6.2 Strings</h1>
<p> <a name="a0000000602" id="a0000000602"></a> </p><p>Strings can be enclosed either in single (<tt class="tt">’</tt>) or double (<tt class="tt">"</tt>) quotes. Strings may also be enclosed by three quote characters in a row: either <tt class="tt">’’’</tt> or <tt class="tt">"""</tt>. Special care needs to be taken when using apostrophes or quotes in single-quote delimited strings, as these characters may be misinterpreted as string delimiters, as in the example: </p><p><table cellspacing="0" class="tabular">
<tr>
<td style="text-align:left"><p><img src="images/img-0039.png" alt="\includegraphics{cross}" style="width:20px; height:24px" />
</p></td>
<td style="text-align:left"><p><div style="width:0.0pt" class="minipage"><tt class="tt"> ’Robert’s data’ </tt></div></p></td>
</tr>
</table> </p><p>This easiest way to avoid such problems is to use three quotes: </p><p><table cellspacing="0" class="tabular">
<tr>
<td style="text-align:left"><p><img src="images/img-0040.png" alt="\includegraphics{tick}" style="width:19px; height:17px" />
</p></td>
<td style="text-align:left"><p><div style="width:0.0pt" class="minipage"><tt class="tt"> ’’’Robert’s data’’’</tt></div></p></td>
</tr>
</table> </p><p>Special characters such as tabs and newlines can be inserted into strings using escape codes such as <tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />t</tt> and <tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />n</tt>; see Table <a href="sec-stringvars.html#tab:escape_sequences2">6.1</a> for a list of these. The following string is split over three lines: </p><p> <tt class="ttfamily">pyxplot> <b class="bfseries">print e’the moon,<img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />nthe moon,<img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />nThey danced by the light of the moon.’</b></tt><br /><tt class="ttfamily">the moon,</tt><br /><tt class="ttfamily">the moon,</tt><br /><tt class="ttfamily">They danced by the light of the moon.</tt> </p><p>Sometimes these escape codes can be rather annoying, especially when entering latex control codes, which all begin with backslash characters. Rather than having to escape every backslash, it is generally easier to prefix the string with the character <tt class="tt">r</tt>, which turns off all escape codes: </p><p> <tt class="ttfamily">pyxplot> <b class="bfseries">print r”’I escaped the quote by typing <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />’.”’</b></tt><br /><tt class="ttfamily">I escaped the quote by typing <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />’.</tt> </p><div id="tab:escape_sequences2" class="table"><center> <table cellspacing="0" class="tabular">
<tr>
<td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-left:1px solid black"><p> <b class="bf">Escape sequence</b> </p></td>
<td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-right:1px solid black"><p> <b class="bf">Description</b> </p></td>
</tr><tr>
<td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />?</tt> </p></td>
<td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-right:1px solid black"><p> Question mark </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />’</tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Apostrophe </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />"</tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Double quote </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0041.png" alt="$\backslash \backslash $" style="vertical-align:-5px;
width:16px;
height:18px" class="math gen" /></tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Literal backslash </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />a</tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Bell character </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />b</tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Backspace </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />f</tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Formfeed </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />n</tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Newline </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />r</tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Carriage return </p></td>
</tr><tr>
<td style="text-align:left; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />t</tt> </p></td>
<td style="text-align:left; border-right:1px solid black"><p> Horizontal tab </p></td>
</tr><tr>
<td style="border-bottom-color:black; border-bottom-width:1px; text-align:left; border-bottom-style:solid; border-left:1px solid black"><p><tt class="tt"><img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />v</tt> </p></td>
<td style="border-bottom-color:black; border-bottom-width:1px; text-align:left; border-bottom-style:solid; border-right:1px solid black"><p> Vertical tab </p></td>
</tr>
</table> </center><div class="caption"><b>Table 6.1</b>: <span>A complete list of Pyxplot’s string escape sequences. These are a subset of those available in C.</span></div></div><p>Once defined, a string variable can be used anywhere in Pyxplot where a quoted string could have been used, for example in the <tt class="tt">set title</tt> command: </p><pre>
plotname = "Insert title here"
set title plotname
</pre><p>Strings can be concatenated together using the <tt class="tt">+</tt> operator: </p><p> <tt class="ttfamily">pyxplot> <b class="bfseries">print "pi = " + pi.str()</b></tt><br /><tt class="ttfamily">pi = 3.1415927</tt> </p></div>
<div class="contents section-contents"><!--<strong>Subsections</strong>-->
<ul>
<li><a href="sec-stringsubop.html">6.2.1 The string substitution operator</a>
</li><li><a href="sect0037.html">6.2.2 Converting strings to numbers</a>
</li><li><a href="sect0038.html">6.2.3 Slicing strings</a>
</li><li><a href="sect0039.html">6.2.4 String methods</a>
</li><li><a href="sect0040.html">6.2.5 Regular expressions</a>
</li>
</ul>
</div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0036.html" title="Instantiating objects"><img alt="Previous: Instantiating objects" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="chap-progDataTypes.html" title="Programming: Pyxplot’s data types"><img alt="Up: Programming: Pyxplot’s data types" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sec-stringsubop.html" title="The string substitution operator"><img alt="Next: The string substitution operator" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>
</body>
</html>
|