python - open text file as input to textblob -


hello it's first question deepest apologies if didn't go rule or so, 'll try best make clear possible

i trying use textblob text file input examples found online of input in sense

wiki = textblob("python high-level, general-purpose programming language.") wiki.tage 

whilst tried this

from textblob import textblob file=open("1.txt"); t=file.read(); print(type(t)) bobo = textblob(t) bobo.tags 

i hope nothing's wrong , thanx lot

edit: code tried did not work

this classic unicode issue

use

import sys    reload(sys)   sys.setdefaultencoding('utf8') 

then read file

in way can use utf-8 encoding/decoding format


Comments