w3schools字串slicing[::],str,len-D11117331陳冠辰

w3schools

h1{border: 10px solid purple; padding: 10px} pre{border: 2px blue solid} table{background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: black; font-family: Verdana, sans-serif; font-size: 15px; margin: 20px 0px; width: 621.99px;}

w3schools

table{background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: black; font-family: Verdana, sans-serif; font-size: 15px; margin: 20px 0px; width: 621.99px;}

w3schools

程式碼

樣式style
#羅夏strings可以用單引雙引只要對稱
b = '狗吃屎,兔吃菜,貓抓鼠'
#    0 1 23 4 5 678 9 10,11,12,
print('字串長度' + str(len(b)))
#len函數 字串長度 輸出 整數
#str函數 轉成字串 這樣才能串接
print(b[-5:-2])
#練習字串格式format
quantity = "滿漢大餐"

程式碼

樣式style
#羅夏strings可以用單引雙引只要對稱
print('字串長度' + str(len(b)))
#len函數 字串長度 輸出 整數
b = '狗吃屎,兔吃菜,貓抓鼠'
#    0 1 23 4 5 678 9 10,11,12,
#str函數 轉成字串 這樣才能串接
print(b[-5:-2])
#練習字串格式format
quantity = "滿漢大餐"

留言

張貼留言

這個網誌中的熱門文章

陳冠辰類別class __init__(self, 其他參數) 6月 05, 2023