一、字符串的驻留机制
  
二、字符串的常用操作
字符串查询  字符串大小写转换  字符串的对齐  字符串的劈分  判断字符串的方法isidentifier()合法标识符、isspace()空白字符、isalpha()字母、isdecimal()十进制的数字、isnumeric()数字、isalnum()字母和数字  字符串的替换合并 
三、字符串的比较操作

四、格式化字符串
age = 20
name = '张三'
print('我叫%s,今年%d岁' % (name,age))
print('我叫{0},今年{1}岁'.format(name,age))
print(f'我叫{name},今年{age}岁')
print('%10d' % 99)
print('%.3f' % 3.1415926)
print('%10.3f' % 3.12412)
print('{0:.3}'.format(3.12412))
print('{0:.3f}'.format(3.12412))
print('{0:10.3f}'.format(3.12412))
五、字符串的编码转换

s.encode(encoding='GBK')
s.encode(encoding='UTF-8')
byte.decode(encoding='UTF-8')
|