<pre><code>def check():
with open('cefuse.txt') as f:
datafile = f.readlines()
for line in datafile:
if line starts with 'Word 30' and contains only 0
return True
return False
</code></pre>
<p>我想检查.txt文件中的一行。如果它只包含0,则retcode将为1,否则为0。
这是我的台词:
字30:0x01312e58</p>
<p>我希望你的期望是这样的</p>
<pre><code>
def check():
with open('cefuse.txt') as f:
datafile = f.readlines()
for line in datafile:
if line startswith('Word 30') and '0' in line:
return True
return False
</code></pre>