You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
640 B

import json
# 从外部文件读取 JSON 数据
file_path = r'D:\dsWork\QingLong\音频文本.txt' # 替换为你的文件路径
with open(file_path, 'r', encoding='utf-8') as file:
json_data = file.read()
# 解析 JSON 数据
data = json.loads(json_data)
# 提取 Text 属性并组装成文稿
text_content = [item['Text'] for item in data]
manuscript = ' '.join(text_content) # 将文本拼接成一个完整的文稿
# 输出或保存文稿
print(manuscript) # 打印到控制台
# 如果需要保存到文件
with open('文稿.txt', 'w', encoding='utf-8') as output_file:
output_file.write(manuscript)