Why Am I Getting Unwanted Newline In My String?
This should be so simple, it's silly. But I can't get it to work. I have a header which I define while reading a file: if '[gene=env]' in line or '[gene=HIV2gp7]' in line:
Solution 1:
I'm assuming you're getting your lines from a file using readline
or readlines
- if so, each line will end with a \n
(newline) character. You need to strip those off:
line = line.rstrip('\n')
Post a Comment for "Why Am I Getting Unwanted Newline In My String?"