Python Forum

Full Version: How to declare TextBlob var
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to get this to work inside a def, it works fine if I get rid of def main(): but when I do it this way no go.
I know I need to declare sAnalyze as something, but what? Any help? Thanks in advance!


from textblob import TextBlob
from textblob import Word
import csv

sAnalyze = tuple

def main(): 
    sAnalyze = TextBlob("You did a good job, thumbs up")
#sAnalyze.sentiment()
print("Polarity" + str(sAnalyze.polarity) + "SubJectivity" + str(sAnalyze.subjectivity))

main()
lines 9 and 10 need indentation
Thanks, apologies for the incorrect post! Indentation corrected the exception.