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))
留言
張貼留言