擅长:python、mysql、java
<p>您还可以跟踪不合适的行而不影响流程/无错误</p>
<pre><code> file = open("sms.txt", "r")
for line_no,line in enumerate(file):
a=word_tokenize(line)
try:
if a[5] == 'SBI' and a[6]== 'Debit':
print a[13]
except IndexError:
print str(line_no)+" line doesn't have expected data"
continue
</code></pre>