国产成人毛片视频|星空传媒久草视频|欧美激情草久视频|久久久久女女|久操超碰在线播放|亚洲强奸一区二区|五月天丁香社区在线|色婷婷成人丁香网|午夜欧美6666|纯肉无码91视频

python字符串刪除第n個字符 python怎么替換很多特定字符串為其他的字符串?

python怎么替換很多特定字符串為其他的字符串?用鏈式替換,示例如下:str1 = "abcdef"str2 = str1.replace("a","1").replace("b","2")prin

python怎么替換很多特定字符串為其他的字符串?

用鏈式替換,示例如下:

str1 = "abcdef"str2 = str1.replace("a","1").replace("b","2")print(str2) #12cdef

2.用正則替換,示例如下:

import restr3 = "abcdef"str4= re.compile("(a|b)").sub("1",str1)print(str4)#11cdef

1 & 2結合應該能解決問題