The following example shows how one can train a classifier with the Sklearn 20 newsgroups data.
>>> from sklearn.feature_extraction.text import TfidfVec
To address questions from comments; The whole basic process of working with tfidf representation in some classification task you should: