下一节:Python 简介 Python 字符串 capitalize() 方法 Python 字符串方法实例大写这句话的第一个字母: txt = "hello, and welcome to my world." x = txt.capitalize() print (x) 运行实例定义和用法capitalize() 方法返回一个字符串,其中第一个字符为大写。语法string.capitalize()参数值无参数更多实例实例请看第一个字符是数字时会发生什么: txt = "63 is my age." x = txt.capitalize() print (x) 运行实例Python 字符串方法 下一节:Python 简介