.title() - annoying mistake

Benjamin Schollnick bschollnick at schollnick.net
Mon Mar 22 11:50:13 EDT 2021


>> I guess it depends on what you mean by "character". In my mind, the
>> first character of string s is s[1], and I would then expect that
>> 
>> s.title()[1] == s[1].upper()
>> 
> 
> I presume you mean [0], but no, that's not the case. A single
> character can titlecase to two characters, or to a single character
> that isn't the same as if you uppercase or lowercase it. See examples
> in previous post.

Or Kanji, etc.  Where a single character can represent more than one in a different unicode standard, as I understand. 

	- Benjamin



More information about the Python-list mailing list