#字符串
res = 'hello,world'
#判断字符串结尾的字母
# print(res.endswith('w'))
#查找字符串中的最右字母下标
# print(res.rindex('o'))
#字符串格式化(%s和format)******
# result = 'my name is {name}, my age is {age}'.format(name='我爱吃西红柿', age=25)
# result1 = 'my name is {0}, my age is {1}'.format('武动乾坤',25)
# result = 'my name is %s, my age is %s' % ('张三丰异界游', 25)
# result1 = 'my name is %s' % '圣墟'
#小写字母边大写
# print(res.swapcase())
# print(res.upper())
#统计字符串里字符的个数*******
# print(res.count('l'))
#把列表变成字符串*******
# s = ''.join(['a','b','c'])
#字符串替换*******
# print(res.replace('l', 'sb', 2))
#查找字符串中最靠左元素的下标*******
# print(res.index('o'))
#把字符串变成列表(以l分割点)*******
# print(res.split('l'))
#判断是否是抬头
# print(res.istitle())
#判断是否是小写
# print(res.islower())
#判断字符串开头字符是否是(w)
# print(res.startswith('w'))
#strip去除首尾字符*******
# res1 = '=====hello,world====='
# print(res1.strip('='))
#去除右边的字符
# print(res1.rstrip('='))
#去除左边的字符
# print(res1.lstrip('='))
#从右往左切,以.为分割,切3刀*******
# res1 = '192.168.1.1'
# print(res1.rsplit('.', 4))
#encode转码,decode解码*******
# res1 = '你好'
# a = res1.encode('utf-8')
# print(a.decode('utf-8'))
#判断是否是空格字符串,而不是判断字符串里是否有空格
# res1 = ' '
# print(res1.isspace())
#find是查找字符串里的元素下标,如果没有返回-1
# print(res.find('qq'))
#字符串拼接*******
# res1 = 'my name is'
# res2 = '申晨林'
# print(res1+res2)
#字符串切片:[0:5]顾头不顾尾,[0:12:2]步长为2也就是隔一个取一个,[:-5]下标为-5(包括-5)往右的字符不要了,[5:]下标为5(不包括5)往左的字符不要了, [4]去字符串中下标为4的字符*******
# print(res[0:5])
# print(res[0:-1:2])
# print(res[:-5])
# print(res[5:])
# print(res[5:][4])