strip question

James Stroud jstroud at mbi.ucla.edu
Sat Jan 27 00:50:33 EST 2007


eight02645999 at yahoo.com wrote:
> hi
> can someone explain strip() for these :
> [code]
> 
>>>>x='www.example.com'
>>>>x.strip('cmowz.')
> 
> 'example'
> [/code]
> 
> when i did this:
> [code]
> 
>>>>x = 'abcd,words.words'
>>>>x.strip(',.')
> 
> 'abcd,words.words'
> [/code]
> 
> it does not strip off "," and "." .Why is this so?
> thanks
> 

strip strips from the ends.


py> x = '...,.,abcd,words.words,,,,.,.,.,.,'
py> x.strip(',.')
'abcd,words.words'


James



More information about the Python-list mailing list