Convert UPPERCASE string to sentence case in Python

后端 未结 2 1658
终归单人心
终归单人心 2020-12-17 07:58

How does one convert an uppercase string to proper sentence-case? Example string:

\"OPERATOR FAIL TO PROPERLY REMOVE SOLID WASTE\"

Using

2条回答
  •  别那么骄傲
    2020-12-17 08:11

    Let's use an even more appropriate function for this: string.capitalize

    >>> s="OPERATOR FAIL TO PROPERLY REMOVE SOLID WASTE"
    >>> s.capitalize()
    'Operator fail to properly remove solid waste'
    

提交回复
热议问题