I have a .txt document called new_data.txt. All data in this document separated by dots. I want to open my file inside python, split it and put inside a list.
output = open('new_data.txt', 'a')
output_list = output.strip().split('.')
AttributeError: 'file' object has no attribute 'strip'
First, you want to open the file in read mode (you have it in append mode)
Then you want to
read() the file:
output = open('new_data.txt', 'r') # See the r output_list = output.read().strip().split('.')
This will get the whole content of the file.
Currently you are working with the file object (hence the error).