parent
06de3f0f74
commit
261cbaed8b
@ -1,20 +0,0 @@
|
||||
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)
|
Loading…
Reference in new issue