單項選擇題在Python中,如何從一個字符串中刪除特定字符?()

A.str.replace(char,’’)
B.str.remove(char)
C.str.delete(char)
D.del str[char]


您可能感興趣的試卷

你可能感興趣的試題

1.單項選擇題在Python中,如何獲取列表的長度?()

A.len(list)
B.list.length()
C.list.size()
D.list.len()

2.單項選擇題在Python中,如何創(chuàng)建一個自定義異常?()

A.class MyException(Exception):pass
B.create Exception(’MyException’)
C.exception MyException
D.new Exception(’MyException’)

3.單項選擇題在Python中,如何使用正則表達(dá)式匹配一個字符串?()

A.re.match(pattern,string)
B.string.match(pattern)
C.pattern.match(string)
D.regex.match(string,pattern)

4.單項選擇題在Python中,如何從字典中獲取一個值,如果鍵不存在則返回默認(rèn)值?()

A.dict.get(key,default)
B.dict[key]or default
C.dict.getValue(key,default)
D.dict.fetch(key,default)

5.單項選擇題在Python中,如何將多個字符串連接成一個字符串?()

A.’’.join(list)
B.str.concat(list)
C.’+’.join(list)
D.list.join()