On Fri, Apr 25, 2008 at 4:29 PM, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote:
> > Whats the result of using id.strip()?: > > In [1]: " asdfasdf ".strip() > Out[1]: 'asdfasdf' > > It should work, I guess... It didn“t for some reason. That was the first thing I tried. > > > Btw, you can write your code without using len in a cleaner way: > > try: > if id[0] == ' ': > id = id[1:] # Note this slice notation... > except: > pass > > try: > if id[-1] == ' ': # id[-1] would be the last character > id = id[:-1] # Again, a slice with only one argument > except: > pass Oh, yeah. Forgot about that. Thanks! Victor
-- http://mail.python.org/mailman/listinfo/python-list