Find characters in a text
<p>I want to create a python script which finds an expression in a text.
If it succeeds, then print 'expression found'.</p>

<p>My text file is named "file_id_ascii"; it comes from a link named "clinical_file_link".</p>

<pre><code> import csv
 import sys
 import io

 file_id_ascii = 
     io.open(clinical_file_link, 'r',
             encoding='us-ascii', errors='ignore')
 acc = 'http://tcga.nci/bcr/xml/clinical/acc/'

 if acc in file_id_ascii:
     print('expression found')
</code></pre>

<p>That code doesn't work...what's wrong?</p>

<pre><code>if 'http://tcga.nci/bcr/xml/clinical/acc/' \
    in open('clinical_file_link.txt').read():
    print "true"
</code></pre>

<p>... works if your file has small content</p>

python xml csv parsing