数据类型—字符串

字符串:

                 字符串是一个有序字符的集合,用于存储和表示基本的文本信息

字符串的切片:

     a = 'red blue"

     a.count("e")

>>>2

    a.count("e",2,7)

>>>0

strip

a = "                alex                    "

a.strip()

replace 

a = " my score is 580 "

a.replace("580","630")

查:find      index      count

删:字符串不可变,不能删除

改:replace    upper    lower   casefold     swapcase   strip    split 

格式化: format    rjust   ljust   join 

判断:  isdigital   startwith   endwith 

猜你喜欢

转载自www.cnblogs.com/jiajin-wu/p/11729951.html