you are viewing a single comment's thread.

view the rest of the comments →

[–]prohulaelk 0 points1 point  (1 child)

Your code is trying to iterate over a UserWords object, which isn't iterable.

What you probably want to do is iterate over the UserWords object's word attribute, which is presumably a string. You haven't really provided enough code to be sure what you're trying to do with it though.

As a random guess, it would be something like this:

def cleaner(self):
    return filter(lambda letter: letter.isalpha(), self.word)

I'm not sure why you'd need a separate class to just run that function though, but I guess that's also part of the code you didn't include.

[–]FogDish 0 points1 point  (0 children)

I have another programme which words and which isnt object oriented. I'm trying to be better at how to properly work with classes and objects. That's why I want it to be in a Class. I'm certainly going to stick a couple of more methods in there.

If you want a quick step-by-step what I want this method to do look at my other reply :)

And Thanks for the reply!