Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to remove EOL characters from imported literal strings?

seq=Word("TCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGA
TCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACTTGAAAGCGAA
AGGGAAACCAGAGGAGCTCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGG
AGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCG")

returns

File "<ipython-input-4-036a51caf660>", line 1
    seq=Word("TCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGA
                                                                                   ^
SyntaxError: EOL while scanning string literal

Of course one could remove the EOLs manually in this case, but when dealing with common DNA sequences this is hardly practical.