I have some data in python as an array as follows :
train = [("Great place to be when you are in Bangalore.", "pos"),
("The place was being renovated when I visited so the seating was limited.", "neg"),
("Loved the ambience, loved the food", "pos"),
("The food is delicious but not over the top.", "neg"),
("Service - Little slow, probably because too many people.", "neg"),
("The place is not easy to locate", "neg"),
("Mushroom fried rice was spicy", "pos"),
("Cocee was hot and spicy", "neg")
]
I want to read this data from a file. So I created a text file and copied the data into it.
Now when I read from the text file using below code :
train = []
text_file = open("testdata.txt", "r")
train = text_file.readlines()
text_file.close()
the train
is having 8 items splitted by each line in the text document. I want it as the same data I am giving in python code. Please help. The mentioned duplicate question did not answer mine.