Python的File class的读取功能可以自动做到这一点。当您在python中打开文件并在文件句柄上调用read函数时,它将以字符串形式读取整个文件并返回该字符串。
with open('my_file.txt', 'r') as f: file_content = f.read() # Read whole file in the file_content string print(file_content)
友情链接: json在线解析 通晓查询 糯晒黄历 姓名打分