.title() - annoying mistake
Paul Bryan
pbryan at anode.ca
Fri Mar 19 10:50:04 EDT 2021
From https://docs.python.org/3.9/library/stdtypes.html#str.title:
> The algorithm uses a simple language-independent definition of a word
> as groups of consecutive letters. The definition works in many
> contexts but it means that apostrophes in contractions and
> possessives form word boundaries, which may not be the desired result
The link above includes a workaround for apostrophes.
Paul
On Fri, 2021-03-19 at 18:43 +0400, Abdur-Rahmaan Janhangeer wrote:
> Greetings list,
>
> See this:
>
> > > > "Python's usage".title()
> "Python'S Usage"
>
> It should have been Python's Usage
>
> Why capitalise the S?
>
> Kind Regards,
>
> Abdur-Rahmaan Janhangeer
> about <https://compileralchemy.github.io/> | blog
> <https://www.pythonkitchen.com>
> github <https://github.com/Abdur-RahmaanJ>
> Mauritius
More information about the Python-list
mailing list