当前位置:  首页>> 技术小册>> Python合辑2-字符串常用方法

14、capitalize()

将字符串中的首个字母转换为大写。

  1. s = 'simple is better than complex'.capitalize()
  2. print(s)
  3. # Simple is better than complex