line = line.strip('\n') line = line.strip('\t')

Read more of this post