[Tutor] Sentiment analysis read from a file
Alan Gauld
alan.gauld at btinternet.com
Wed Mar 28 14:25:19 EDT 2018
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 binary files so open it with mode 'rb' not 'r'
> That's no longer true for Python 3:
And i should have remembered that, I'm too used to using CSV on v2.
I did say it was a quick response, I didn't actually try anything :-)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list