On 07/03/15 13:15, Akash Shekhar wrote:
I am trying to learn how to use strip() method. It is supposed to cut out
all the whitespace as I read in the tutorial.

Read it again more closely.

-------------------
Help on built-in function strip:

strip(...)
    S.strip([chars]) -> string or unicode

    Return a copy of the string S with leading and trailing
    whitespace removed.
    If chars is given and not None, remove characters in chars instead.
    If chars is unicode, S will be converted to unicode before stripping
----------------------

So it only strips leading and training whitespace, not the whitespace inside the string. (Use str.translate() for that)
HTH

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to