多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
字符串格式化是指用占位符%s,%d等先占一个字符的位置,之后用%22 这样的值将占得位置填上。类似于填空题 \>>> a="hello %s" % "world" \>>> a 'hello world' \>>> "%d years old" % 22 '22 years old' \>>> \>>> "I am a %s,i like %s, my age is %d"%("student","python",22) \#字符型的量必须加双引号 'I am a student,i like python, my age is 22' \>>> string.format()格式化方法 \#类似于数组一样,占位符用花括号包含数组下标表示,不用考虑字符类型 \>>> "I am a {0}, i like {1},my age is {2}".format("student","python",22) 'I am a student, i like python,my age is 22' \>>> (6) **字符编码** S.encode(‘ANSI’) #转化成指定编码格式 S.decode() \#decode将字节转化为字符串 避免中文是乱码 在开头申明 #coding:utf-8 (7) **列表**