Python 字符串内置方法
string = ' deng juO chao'
m_string = string.strip() #移除两边空格
print(m_string)
if m_string.startswith('deng1'): #判断起始位置的字符串是否存在
print('yes')
else:
print('no')
if m_string.endswith('chao'): #判断结尾位置的字符串是否存在
print('yes')
else:
print('no')
print(m_string.replace('d','p')) #替换字符串
print(m_string.split('h')) #分割列表
print(m_string.upper()) #转化成大写
print(m_string.lower()) #转化为小写
print(m_string.isdigit()) #判断字符是否为数字
print ('{x},{y},{c}'.format(x='haha',y='hehe',c='hh')) #格式化字符串
print(m_string.swapcase()) #大小写翻转
print(m_string.title()) #每个字符串首字母大写
print(m_string.find('u',0,10)) #顾头不顾尾 找到返回索引 找不到返回-1