<pre><code>import tailer
test = tailer.tail(open("test.txt"), 1)
#print(lines[1])
</code></pre>
<p>它和上面的代码一样简单,但不起作用</p>
<p>(我之所以保存它,是因为它在实验过程中成功了一次,但稍后再次运行时出错。)</p>
<p><strong>错误内容:</strong></p>
<pre><code>Traceback (most recent call last):
File "c:\Users\user\Documents\VSCODE\python\V1\tailer.py", line 1, in <module>
import tailer
File "c:\Users\user\Documents\VSCODE\python\V1\tailer.py", line 3, in <module>
test = tailer.tail(open("test.txt"), 1)
AttributeError: partially initialized module 'tailer' has no attribute 'tail' (most likely due to a circular import)
</code></pre>