首页题库练习题目详情
Python程序设计单选题中等

以下代码用于读取文件内容并打印,正确的写法是:

0{ "key": "A", "text": "f = open('data.txt', 'r'); print(f.read())" }
1{ "key": "B", "text": "with open('data.txt', 'r') as f: print(f.read())" }
2{ "key": "C", "text": "print(open('data.txt', 'r').read())" }
3{ "key": "D", "text": "全部正确" }