题目内容

以下哪个代码是正确的读取一个文件?

A. f = open("test.txt","read")
B. f = open("r", "test.txt")
C. f = open("test.txt","r")
D. f = open("read","test.txt")

查看答案
更多问题

以下哪个代码是正确的打开文件并准备写入?

A. f = open("test.txt", "w")
B. f = open("test.txt", "write")
C. f = open("write", "test.txt")
D. f = open("w", "test.txt")

Python 中,以下哪个代码是正确的字典?

A. myexample = {'someItem'=>2, 'otherItem'=>20}
B. myexample = {'someItem':2, 'otherItem':20}
C. myexample = ('someItem'=>2, 'otherItem'=>20)
D. myexample = ('someItem'=>2, 'otherItem'=>20)

以下哪个代码是将字符串转换为浮点数?

A. int(x [,base])
B. long(x [,base])
C. float(x)
D. str(x)

以下哪个 if 语句是正确的?

A. if a >= 22:
B. if (a >= 22)
C. if (a => 22)
D. if a >= 22

答案查题题库