将字符串 "example" 中的字母 a 替换为字母 b,以下代码正确的是?
A. example.swap('b', 'a')
B. example.replace('a', 'b')
C. example.match('b', 'a')
D. example.replace('b', 'a')
查看答案
Python 中,以下哪个代码是正确的列表?
A. sampleList = {1,2,3,4,5}
B. sampleList = (1,2,3,4,5)
C. sampleList = /1,2,3,4,5/
D. sampleList = [1,2,3,4,5]
Python 中,以下哪个代码是正确的元组?
A. sampleList = (1,2,3,4,5)
B. sampleList = {1,2,3,4,5}
C. sampleList = [1,2,3,4,5]
D. sampleList = /1,2,3,4,5/
Python 中,以下哪个变量的赋值是正确的?
A. var a = 2
B. int a = 2
C. a = 2
D. variable a = 2
变量 a 的值为字符串类型的 "2",如何将它转换为整型?
A. castToInt(a)
B. int(a)
C. integer(a)
D. castToInteger(a)