1 a="i am {a},age {b}" 2 v=a.format(a="cat",b="18") 3 print(v) 4 a="i am {0},age {1}" 5 v=a.format("cat","18") 6 print(v) 7 a="congratulation" 8 b=a.find('a',0,14) 9 print(b) 10 a="cat" 11 b=a.join("mm") 12 print(b) 13 a="cat" 14 b=a.split("a",maxsplit=1) 15 print(b) 16 a="cat" 17 b=a.strip("c") 18 print(b)
format:固定站位,find:找字符位置,join:把a内容加入字符串中,spilt:去掉某个元素的输出,strip:去除某个元素输出