擅长:python、mysql、java
<p>reservation只是遍历list reservationList的迭代器,它没有定义任何写函数。
从文本文件中读取数据有三种方法。在</p>
<pre><code>read() : Returns the read bytes in form of a string. Reads n bytes, if no n specified, reads the entire file.
File_object.read([n])
readline() : Reads a line of the file and returns in form of a string.For specified n, reads at most n bytes. However, does not reads more than one line, even if n exceeds the length of the line.
File_object.readline([n])
readlines() : Reads all the lines and return them as each line a string element in a list.
File_object.readlines()
</code></pre>
<p>以下是打开并读取文件的示例:</p>
^{pr2}$