from string import capwords
capwords('\"this is test\", please tell me.')
# output: '\"this Is Test\", Please Tell Me.'
^
Why is it not equal to this? ↓
'\"This Is Test\", Please Tell Me.'
^
How can I do it?
It doesn't work because it is naive and is confused by the leading "
which makes it think that "This
does not begin with a letter.
Use the built-in string method .title()
instead.
>>> '\"this is test\", please tell me.'.title()
'"This Is Test", Please Tell Me.'
This probably is the reason why capwords()
remains in the string
module but was never made a string method.