符码转换
ord(a)=65 //ord获得字符的整数表示
chr(65)=‘a’ //chr把编码转化成相应的字符
字符串格式化
- 常规:print(‘%s%d’,’hello’,42)//注意一一对应
2、format print:({0}{1}.format(‘hello’,42))#在{0}填hello
3、f-string:r=2.5 s=3,14*r*2 print(f’{r}{s:%.2f}’)
ord(a)=65 //ord获得字符的整数表示
chr(65)=‘a’ //chr把编码转化成相应的字符
2、format print:({0}{1}.format(‘hello’,42))#在{0}填hello
3、f-string:r=2.5 s=3,14*r*2 print(f’{r}{s:%.2f}’)