s = www.edureka.in

print s.strip(string.lowercase)

 

Output -  .edureka.

 

It is because strip function removes the mentioned leading and training values and not from in-between the string. In this case lowercase letters were supposed to be removed. 

 

Hence it removed the leading lowercase letters before it encounters a non-lowercase character i.e.  ' . ' in this case. Similarly it removes all the trailing lowercase letter from the end till it encounter  ' . ' i.e. a non-lowercase character. 


To make it more easier to understand lets replace . with a capital letter and execute the code again.


s = wwwRedurekaRin

print s.strip(string.lowercase)

 

Output - RedurekaR

 

It removes all the lowercase letters from the start and the end till it encounters a capital letter on both sides.