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
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
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
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
thanks!
--
http://mail.python.org/mailman/listinfo/python-list
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('')
> >
>
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
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
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