\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k+kn}{from} \PYG{n+nn}{Bio.SeqIO.QualityIO} \PYG{k+kn}{import} \PYG{n}{FastqGeneralIterator}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{count} \PYG{o}{=} \PYG{l+m+mi}{0}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{total\PYGZus{}len} \PYG{o}{=} \PYG{l+m+mi}{0}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{with} \PYG{n+nb}{open}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}example.fastq\PYGZdq{}}\PYG{p}{)} \PYG{k}{as} \PYG{n}{in\PYGZus{}handle}\PYG{p}{:}
\PYG{g+gp}{... }    \PYG{k}{for} \PYG{n}{title}\PYG{p}{,} \PYG{n}{seq}\PYG{p}{,} \PYG{n}{qual} \PYG{o+ow}{in} \PYG{n}{FastqGeneralIterator}\PYG{p}{(}\PYG{n}{in\PYGZus{}handle}\PYG{p}{):}
\PYG{g+gp}{... }        \PYG{n}{count} \PYG{o}{+=} \PYG{l+m+mi}{1}
\PYG{g+gp}{... }        \PYG{n}{total\PYGZus{}len} \PYG{o}{+=} \PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{seq}\PYG{p}{)}
\PYG{g+gp}{...}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZpc{}i}\PYG{l+s+s2}{ records with total sequence length }\PYG{l+s+si}{\PYGZpc{}i}\PYG{l+s+s2}{\PYGZdq{}} \PYG{o}{\PYGZpc{}} \PYG{p}{(}\PYG{n}{count}\PYG{p}{,} \PYG{n}{total\PYGZus{}len}\PYG{p}{))}
\PYG{g+go}{3 records with total sequence length 75}
\end{Verbatim}
