python中字符串的常用方法講解

#!/usr/bin/env/python #--coding:utf-8 -- #Author:yzy # 字符串的替換功能通過repalce str1=‘admin’ print(str1.replace(‘ad’,‘baidu’)) 2.查找字符串的索引通過find str1=‘admin’ print(str1.find(‘a’)) # 3.字符串以什麼什麼開頭(startswith)結尾
相關文章
相關標籤/搜索