python - Why does the istitle() string method return false if the string is clearly in title-case? -


Return to true, if the string title is a categorized string and has at least one letter, for example uppercase letters can only obey untold characters and lowercase letters. Otherwise return false.

But in this case it returns false:

  gt; & Gt; Book = 'every programmer should know' & gt; & Gt; & Gt; Book.title () 'Every Programmer Should Know' & gt; & Gt; & Gt; Book.istitle () Wrong  

What am I missing?

The title of the method () is not to change the string (telegram is irreversible in Python) This is a new string That you have to assign to your variable:

  & gt; & Gt; & Gt; Book = 'every programmer should know' & gt; & Gt; & Gt; Book = book.title () & gt; & Gt; & Gt; Book.istitle () is true  

Comments