劉子鳴python字串string內建built-in方法methods

VS Code開發環境w3schools截圖

字串程式碼

a = "ha,我很帥,我能使用w3school學習,也能使用VSCODE開發環境 b = a.replace('很帥','超帥') print(a) print(b) print('幾個帥?', a.count('帥')) print('很在0,1..位置', a.find('帥')) print('很在0,1..位置', a.rfind('帥')) txt = "hello,將第一個字子母轉成大寫" x = txt.capitalize() print (x) print (txt.casefold()) y = txt.center(30) print(txt.center(30)) print(y) print(len(y))

留言

這個網誌中的熱門文章

金三甲期末考重要題庫與額未加分作業

空頭價差多頭價差跨式勒式

劉子鳴:行為財務 BRK波克夏海瑟威公司股價