I'm reading a text file and splitting the sentence into a list based on arguments I pass. Splitting the data is working file. But at the end I get an empty string. How can I avoid that
def duplicate(input): emp = [] with open(input, 'r') as file: for item in file: value = item.strip().split('.') emp.extend(value) return emp
This is the python code I used to split. The argument is '.' . But at the end I am getting an empty string. 'this is commonly referred to as the “application factory” pattern', ''. Is there any other way to avoid this empty string at the end.