python字符串拼接常用方法
摘要:一、%s拼接 print('%s world %s' % (hello,python)) ==>hello world python %s表示字符串一个占位符,拼接的内容在单独的%的后面,多个拼接的字符串用逗号隔开 类似占位符有 %d 代表一个整数 、%f 代表一个浮点数 、%x 代表一个16进制数
阅读全文
python大小写转换
摘要:python中对字符串的大小写转换 一、对字符串中所有字符的大小写转换(仅对字母有效) str = 'Hello world' #全部转换成大写 str.upper() ==>HELLO WORLD #全部转换成小写 str.lower() ==>hellow world 二、对字符串中的字符部分大
阅读全文