In the comments, you can see that they're not familiar with the differences between the binary (bytes) and text (str) types and how to convert between them (the decode call I mentioned above):
the error i faced when i used read() . 'if files in f1.read():TypeError: a bytes-like object is required, not 'str' ' . r = f1.readlines() returns a list and i am not able to find a way to find a string in that list
They don't grasp that the in operator does not perform a contains check on each element of the list, but rather performs an equality check against each element. This is evidenced by the fact they need assistance, rather than solving the problem themselves.
Given that they are not familiar with the differences between binary and text types, it is also highly likely they are not familiar with text encodings and the issues surrounding them. They must learn about this topic to determine the correct encoding to apply.
There is also a concern with respect to styles of newlines. It's not clear if they wish to normalize the newlines, consider differences, or disallow the search string from containing them, which would allow them to be ignored. That they did not include information about this detail suggests they may not be aware of these issues, either.
The accepted answer was also wrong at the time it was accepted. It converted the list of lines into the repr, which formats the list into a literal expression (including the list brackets, quote marks, and escape sequences). That the asker did not recognize this also indicates they are missing knowledge about str and how it behaves on lists.
In the comments, you can see that they're not familiar with the differences between the binary (bytes) and text (str) types and how to convert between them (the decode call I mentioned above):
the error i faced when i used read() . 'if files in f1.read():TypeError: a bytes-like object is required, not 'str' ' . r = f1.readlines() returns a list and i am not able to find a way to find a string in that list
They don't grasp that the in operator does not perform a contains check on each element of the list, but rather performs an equality check against each element. This is evidenced by the fact they need assistance, rather than solving the problem themselves.
Given that they are not familiar with the differences between binary and text types, it is also highly likely they are not familiar with text encodings and the issues surrounding them.
There is also a concern with respect to styles of newlines. It's not clear if they wish to normalize the newlines, consider differences, or disallow the search string from containing them, which would allow them to be ignored. That they did not include information about this detail suggests they may not be aware of these issues, either.
The accepted answer was also wrong at the time it was accepted. It converted the list of lines into the repr, which formats the list into a literal expression (including the list brackets, quote marks, and escape sequences). That the asker did not recognize this also indicates they are missing knowledge about str and how it behaves on lists.
In the comments, you can see that they're not familiar with the differences between the binary (bytes) and text (str) types and how to convert between them (the decode call I mentioned above):
the error i faced when i used read() . 'if files in f1.read():TypeError: a bytes-like object is required, not 'str' ' . r = f1.readlines() returns a list and i am not able to find a way to find a string in that list
They don't grasp that the in operator does not perform a contains check on each element of the list, but rather performs an equality check against each element. This is evidenced by the fact they need assistance, rather than solving the problem themselves.
Given that they are not familiar with the differences between binary and text types, it is also highly likely they are not familiar with text encodings and the issues surrounding them. They must learn about this topic to determine the correct encoding to apply.
There is also a concern with respect to styles of newlines. It's not clear if they wish to normalize the newlines, consider differences, or disallow the search string from containing them, which would allow them to be ignored. That they did not include information about this detail suggests they may not be aware of these issues, either.
The accepted answer was also wrong at the time it was accepted. It converted the list of lines into the repr, which formats the list into a literal expression (including the list brackets, quote marks, and escape sequences). That the asker did not recognize this also indicates they are missing knowledge about str and how it behaves on lists.