import json
# 1. 指定文本文件路径
text_file_path = './1.json'
# 2. 打开文件并读取内容
with open(text_file_path, 'r') as file:
# 3. 使用 read() 方法读取整个文件内容
file_content = file.read()
# 4. 处理读取到的文本内容
print(file_content)
print(json.loads(file_content))
import json
# 1. 指定文本文件路径
text_file_path = './1.json'
# 2. 打开文件并读取内容
with open(text_file_path, 'r') as file:
# 3. 使用 read() 方法读取整个文件内容
file_content = file.read()
# 4. 处理读取到的文本内容
print(file_content)
print(json.loads(file_content))
本文标题:读取文件内容
本文链接:https://www.haomeiwen.com/subject/gwxmndtx.html
网友评论