VS Code與w3school截圖 程式碼 txt = "hello林芳如, and welcome to my world." x = txt.capitalize() print (x) print(txt.replace("芳如","總統")) a = "我使用w3schools學習,也會使用vsCode開發環境" b = a.replace('變態','瀟灑') print (a) print (b) print ('幾個很?', a.count('很')) print ('很在0,1..位置', a.find('很')) print ('很在0,1..位置', a.rfind('很')) print ('a的長度',len(a)) print('英文大寫',a.upper()) print('英文小寫',a.lower()) txt = "HELLO,將第一個字母轉成大寫。" x = txt.capitalize() print (x) print (txt.casefold()) y = txt.center(30) print(txt.center(30)) print(y) print(len(y)) w3school字串方法列表 https://www.w3schools.com/python/python_ref_string.asp capitalize() Converts the first character to upper case casefold() Converts string into lower case center() Returns a centered string count() Returns the number of times a specified value occurs in a string encode() Returns an encoded version of the string endswith...