擅长:python、mysql、java
<p>方法之一是:</p>
<pre><code>with open('sometext.txt') as f:
contents = f.read()
print(contents)
</code></pre>
<p>还要记住,<code>readlines()</code></p>
<blockquote>
<p>to read the text file and returns the file contents as a list of
strings:</p>
</blockquote>
<pre><code>azzurlread = azzurl.readlines()
for line in azzurlread:
print(line)
</code></pre>