AttributeError: str object has no attribute write ( Solved )
Solution 1: Using File type object –. To solve this issue, we can change the caller object. Since the file type of the object supports this write () attribute. Hence we will use it. Please refer to the below solution. sample_text= "Data Science Learner" sample_file_name = 'sample.txt' with open (sample_file_name, 'w', encoding= 'utf-8') as ...