Error: must be str, not generator in Python
<p>I am using python and here is a piece of my code:</p>

<pre><code>wp = open(outfile, 'w')
fields = line.split('\t')
gene_ID = fields[0]
chr = fields[1]
strand = fields[2]
start = int(fields[3])
end = int(fields[4])
bc = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N':'N'}       
if strand == '+':
    wp.write(chr_string[start:end]) 
if strand == '-':
    newstart, newend = -(start + 1), -(end + 1)
    wp.write(bc[base.upper()] for base in chr_string[newstart:newend]) &lt;--error pointed at this line
</code></pre>

<p>When I try to run my whole code, I get the following message:</p>

<pre><code>TypeError: must be str, not generator
</code></pre>

<p>Does anyone know what is wrong with my code that is prompting this?</p>
