I think this is more of what you ar looking for: >>> a = 'this is a list with is repeated twice.' >>> a 'this is a list with is repeated twice.' >>> alist = a.strip().split() >>> alist ['this', 'is', 'a', 'list', 'with', 'is', 'repeated', 'twice.'] >>> var='is' >>> alist.count(var) 2 >>>
On Wed, Jun 20, 2012 at 8:44 AM, Oğuzhan Öğreden <ogre...@gmail.com> wrote: > Sorry, it seems like I was not clear enough in that statement. I should > have written something like "counting how many times each word occured" > insted of "counting words".
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor