Re: [Tutor] Looking for Words - Help

2013-10-12 Thread Alan Gauld
On 12/10/13 06:18, Jackie Canales wrote: for line in lst.splitlines(): if word in line: words = line Notice that you are overwriting words each time you get a match. So the final value of words at the end of the for loop will just be the last line found. All earlier

Re: [Tutor] Cannot understand object initiation

2013-10-12 Thread bob gailer
On 10/12/2013 11:01 AM, Kush Goyal wrote: [[snip] "user = User.query.filter_by ( username = self.username.data ).first()" now this I do not understand. Can a object be create by using a method of a class instead of the class consturctor? I Without seeing the code you reference (User module) I

Re: [Tutor] Cannot understand object initiation

2013-10-12 Thread Alan Gauld
On 12/10/13 16:01, Kush Goyal wrote: Hi, I am learning web development by using flask framework. The below code is used to create a class LoginForm which inherits from the class Form. In the method 'validate' of class 'LoginForm' the variable 'user' is initialized by using: "user = User.query.

[Tutor] Cannot understand object initiation

2013-10-12 Thread Kush Goyal
Hi, I am learning web development by using flask framework. The below code is used to create a class LoginForm which inherits from the class Form. In the method 'validate' of class 'LoginForm' the variable 'user' is initialized by using: "user = User.query.filter_by ( username = self.username.da

Re: [Tutor] Looking for Words - Help

2013-10-12 Thread Dave Angel
On 12/10/2013 01:18, Jackie Canales wrote: You're still posting in html, not text. I stripped out the markup portion of your message, but you're still left with lots of invisible characters in the following. Your email program is stuffing "\xa0" characters in place of every other space, which cut

Re: [Tutor] Looking for Words - Help

2013-10-12 Thread Mark Lawrence
On 12/10/2013 06:18, Jackie Canales wrote: from string import punctuation #helper function I'd be inclined to call this strippunc as strip is use so often. def strip(text): 'returns text with all punctuation removed' for symb in punctuation: #import from string text = text

Re: [Tutor] Looking for Words - Help

2013-10-12 Thread Jackie Canales
from string import punctuation #helper function def strip(text):     'returns text with all punctuation removed'     for symb in punctuation: #import from string         text = text.replace(symb, ' ')              return text #helper function def wordin(s,t):     'does word s occur in text t'