摘要: #字符串操作#example1 字符串截取strs = '123456789'print strs[0:1] #1 输出0到1的字符print strs[1:6]#23456 输出1~6的字符串num = 18strs = '00000' + str(num) #合并字符串print strs[-5:]#00018 输出字符串右5位#example2 字符串替换str = 'akakak'str = str.replace('k',8) #将字符串里的卡全部替换成8print str#'a8a8a8'#exampl 阅读全文
posted @ 2013-06-26 20:11 我叫龙弟弟 阅读(196) 评论(0) 推荐(0)