单项选择题
在Python中,如何写入一个文件?()
A.with open(file,’w’)as f:f write(content)
B.file.write(content)
C.open(file,’w’).write(content)
D.A和C都对
点击查看答案&解析
相关考题
-
单项选择题
在Python中,如何读取一个文件的内容?()
A.with open(file,’r’)as f:content =f read()
B.file.read()
C.open(file,’r’).read()
D.A和C都对 -
单项选择题
在Python中,如何检查一个变量是否为None?()
A.variable is None
B.variable ==None
C.variable ===None
D.A和B都对 -
单项选择题
在Python中,如何使用装饰器?()
A.@decorator def func():pass
B.def func()decorator:pass
C.func =decorator(func)
D.A和C都对
