This is just a part of my script :
This script is to extract data from a logfile to a text file.
self.cut.start_line='test started'
def extract_data(self):
data=None
for line in self.file_content:
if data is None:
if self.start_line in line: #search for 'test started'
data=[]
elif self.end_line in line:
break
else:
data.append(line)
return data
I wrote this script using Python 2 but when I run in Python 3 it shows:
>>> if self.start_line in line: #search for 'test started'
TypeError: a bytes-like object is required, not 'str'
Can somebody help me?
b'test started'self.file_contentis bytes. stackoverflow.com/questions/33054527/…