Re: string stripping issues

2006-03-03 Thread Larry Bates
orangeDinosaur wrote: > Hello, > > I am encountering a behavior I can think of reason for. Sometimes, > when I use the .strip module for strings, it takes away more than what > I've specified. For example: > a = 'Hughes. John\r\n' > a.strip('') > > returns: > > 'ughes. John

Re: string stripping issues

2006-03-03 Thread Iain King
Ben Cartwright wrote: > Ben Cartwright wrote: > > orangeDinosaur wrote: > > > I am encountering a behavior I can think of reason for. Sometimes, > > > when I use the .strip module for strings, it takes away more than what > > > I've specified. For example: > > > > > > >>> a = 'Hughes. John\r

Re: string stripping issues

2006-03-03 Thread Tim Williams (gmail)
On 3 Mar 2006 00:20:21 -0800, P Boy <[EMAIL PROTECTED]> wrote: This seems like a web page parsing question. Another approach can be asfollows if you know the limiting token strings:a.split('SIZE=2>')[1].split('\r\n')[0] As others have mentioned , you really need a an HTML parser.   But the fo

Re: string stripping issues

2006-03-03 Thread P Boy
This seems like a web page parsing question. Another approach can be as follows if you know the limiting token strings: a.split('')[1].split('\r\n')[0] -- http://mail.python.org/mailman/listinfo/python-list

Re: string stripping issues

2006-03-02 Thread orangeDinosaur
thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: string stripping issues

2006-03-02 Thread Ben Cartwright
Ben Cartwright wrote: > orangeDinosaur wrote: > > I am encountering a behavior I can think of reason for. Sometimes, > > when I use the .strip module for strings, it takes away more than what > > I've specified. For example: > > > > >>> a = 'Hughes. John\r\n' > > > > >>> a.strip('') > > >

Re: string stripping issues

2006-03-02 Thread ianaré
from the python manual: strip( [chars]) The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped: >>> 'www.example.com'.strip('cmowz.') 'example' in your case since the letter 'H' is in your [chars] and the name starts with an H it gets stripped, b

Re: string stripping issues

2006-03-02 Thread Ben Cartwright
orangeDinosaur wrote: > I am encountering a behavior I can think of reason for. Sometimes, > when I use the .strip module for strings, it takes away more than what > I've specified. For example: > > >>> a = 'Hughes. John\r\n' > > >>> a.strip('') > > returns: > > 'ughes. John\r\n' > > Howe

string stripping issues

2006-03-02 Thread orangeDinosaur
Hello, I am encountering a behavior I can think of reason for. Sometimes, when I use the .strip module for strings, it takes away more than what I've specified. For example: >>> a = 'Hughes. John\r\n' >>> a.strip('') returns: 'ughes. John\r\n' However, if I take another string, for