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)