Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Alan Gauld via Tutor
On 28/03/18 18:14, Peter Otten wrote: >> Just a quick response, but your data is more than a text file its a CSV next(open("training.txt")) > '1\tThe Da Vinci Code book is just awesome.\n' > > So the delimiter would be TAB: Ah! On my screen it looked like a space... > The CSV module prefers b

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Rajesh Balel
seems you have "tab separated data with open('Training.txt') as f: my_data = [x.strip().split('\t') for x in f.readlines()] for x in my_data: print x, Regards Rajesh On Wed, Mar 28, 2018 at 10:14 AM, Peter Otten <__pete...@web.de> wrote: > Alan Gauld via Tutor wrote: > > > On 28/03/18 11:0

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Peter Otten
Alan Gauld via Tutor wrote: > On 28/03/18 11:07, theano orf wrote: >> I am new in python and I am having problems of how to read a txt file and >> insert the data in a list, > > Just a quick response, but your data is more than a text file its a CSV > file so the rules change slightly. Especially

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Alan Gauld via Tutor
On 28/03/18 11:07, theano orf wrote: > I am new in python and I am having problems of how to read a txt file and > insert the data in a list, Just a quick response, but your data is more than a text file its a CSV file so the rules change slightly. Especially since you are using the csv module.