Readline Stripping [python]

That is a terrible title.


I’ve been working through Coursera’s bioinformatics 1 course with P.Compeau and P.Pevzner. It has a coding component on its companion stepic website.

I just spent the past half hour meticulously debugging why I was getting correct answers on the small case sets, but wrong answers on the larger test sets.. It turns out, even for txt files you have to strip() your readlines.. I’m really not sure why it does this, but readline seems to leave the \n newline character at the end, and this character counts for the length of the string as well.

Well now I know.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s