This file is indexed.

/usr/share/doc/pyxplot/html/sect0054.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
<!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: File handles</title>

<link href="sect0055.html" title="Storing data structures in text files" rel="next" />
<link href="sect0053.html" title="Modules and classes" 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="sect0053.html" title="Modules and classes"><img alt="Previous: Modules and classes" 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="sect0055.html" title="Storing data structures in text files"><img alt="Next: Storing data structures in text files" 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">File handles</b>
</span>
</span>
<hr />
</div>

<div><h1 id="a0000000055">6.9 File handles</h1>
<p>File handles provide a means of reading data directly from text files, or of writing data or logging information to files. Files are opened using the <tt class="tt">open()</tt> function: </p><p>    <big class="large"><b class="bf">open(<img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />[,<img src="images/img-0031.png" alt="$y$" style="vertical-align:-4px; 
                                     width:9px; 
                                     height:12px" class="math gen" />])</b></big> <br />The open(<img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />[,<img src="images/img-0031.png" alt="$y$" style="vertical-align:-4px; 
                                     width:9px; 
                                     height:12px" class="math gen" />]) function opens the file <img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" /> with string access mode <img src="images/img-0031.png" alt="$y$" style="vertical-align:-4px; 
                                     width:9px; 
                                     height:12px" class="math gen" />, and returns a file handle object. <a name="a0000000639" id="a0000000639"></a>  </p><p>The most commonly used access modes are <tt class="tt">"r"</tt>, to open a file read-only, <tt class="tt">"w"</tt>, to open a file for writing, erasing any pre-existing file of the same filename, and <tt class="tt">"a"</tt>, to append data to the end of a file. </p><p>Alternatively, if what is wanted is a temporary scratch space, the <tt class="tt">os.tmpfile()</tt> function should be used: </p><p>    <big class="large"><b class="bf">os.tmpfile()</b></big> <br />The os.tmpfile() function returns a file handle for a temporary file. The resulting file handle is open for both reading and writing. <a name="a0000000640" id="a0000000640"></a>  </p><p>The following methods are defined for file handles: </p><p>   <big class="large"><b class="bf">close()</b></big> <br />The close() method closes a file handle. <a name="a0000000641" id="a0000000641"></a>  </p><p>    <big class="large"><b class="bf">dump(<img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />)</b></big> <br />The dump(<img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />) method stores a typeable ASCII representation of the object <img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" /> to a file. Note that this method has no checking for recursive hierarchical data structures. <a name="a0000000642" id="a0000000642"></a>  </p><p>    <big class="large"><b class="bf">eof()</b></big> <br />The eof() method returns a boolean flag to indicate whether the end of a file has been reached. <a name="a0000000643" id="a0000000643"></a>  </p><p>    <big class="large"><b class="bf">flush()</b></big> <br />The flush() method flushes any buffered data which has not yet physically been written to a file. <a name="a0000000644" id="a0000000644"></a>  </p><p>    <big class="large"><b class="bf">getPos()</b></big> <br />The getPos() method returns a file handle’s current position in a file. <a name="a0000000645" id="a0000000645"></a>  </p><p>    <big class="large"><b class="bf">isOpen()</b></big> <br />The isOpen() method returns a boolean flag indicating whether a file is open. <a name="a0000000646" id="a0000000646"></a>  </p><p>    <big class="large"><b class="bf">read()</b></big> <br />The read() method returns the contents of a file as a string. <a name="a0000000647" id="a0000000647"></a>  </p><p>    <big class="large"><b class="bf">readline()</b></big> <br />The readline() method returns a single line of a file as a string. <a name="a0000000648" id="a0000000648"></a>  </p><p>    <big class="large"><b class="bf">readlines()</b></big> <br />The readlines() method returns the lines of a file as a list of strings. <a name="a0000000649" id="a0000000649"></a>  </p><p>    <big class="large"><b class="bf">setPos(<img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />)</b></big> <br />The setPos(<img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />) method sets a file handle’s current position in a file. <a name="a0000000650" id="a0000000650"></a>  </p><p>    <big class="large"><b class="bf">write(<img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />)</b></big> <br />The write(<img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />) method writes the string <img src="images/img-0030.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" /> to a file. <a name="a0000000651" id="a0000000651"></a>  </p></div>

<div class="contents section-contents"><!--<strong>Subsections</strong>-->
<ul>
<li><a href="sect0055.html">6.9.1 Storing data structures in text files</a>
   
</li>



</ul>
</div>



<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0053.html" title="Modules and classes"><img alt="Previous: Modules and classes" 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="sect0055.html" title="Storing data structures in text files"><img alt="Next: Storing data structures in text files" 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>