I am trying to execute this code snippet in python 3.8
def load_rightprob(self, rightprob_file): ''' dictionary with # people keys with # actions ''' rightProb = {} for line in open(rightprob_file): items = line.strip().split("\t") if len(items) != len(self.action_qid_dict) + 1: continue pid = int(items[0]) but I get this error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
I tried for line in open(rightprob_file, **'rb'**): instead but I get challenges on the following line with this error:
TypeError: a bytes-like object is required, not 'str' Can somebody please suggest how to fix this? I am reading from a .txt file where each line is an ID, followed by 377 columns representing probability values associated with this ID

FFin byte 0 means it's 99% likely to be a BOM for UTF-16 little-endian.