MIT 6.001X 2016 (2)core elelments of programs

strings (字符串型): using 單引號 '' or 雙引號  "" a = 'abc'   or a = "a" b = 'def' 適用於字符串型操作: 1. 乘   3*a = 'abcabc' 2.加   a+b = 'abcdef' 3. 求長度  len(a) = 3  4.index  檢索  a[2] = 'c'  5.slice 切片 a[1:] = 'bc'     
相關文章
相關標籤/搜索