我在翻译中做了这一切......
loc1 = '/council/council1'
file1 = open(loc1, 'r')
Run Code Online (Sandbox Code Playgroud)
此时我可以执行file1.read()并将文件的内容作为字符串打印到标准输出
但如果我加上这个..
string1 = file1.read()
Run Code Online (Sandbox Code Playgroud)
字符串1回来了空..我不知道我可能做错了什么.这似乎是最基本的东西!
如果我继续再次输入file1.read(),则输出到标准输出只是一个空字符串.所以,当我尝试使用file1.read()创建一个字符串时,我失去了我的文件