It’s because you’re opening the file in bytes mode, and so you’re calling bytes.startswith() and not str.startswith().
You need to do line.startswith(b'>'), which will make '>' a bytes literal.
It’s because you’re opening the file in bytes mode, and so you’re calling bytes.startswith() and not str.startswith().
You need to do line.startswith(b'>'), which will make '>' a bytes literal.