代码
import os
import random
from time import sleep
import requests
import docx
from utils.AuthV3Util import addAuthParams
# 您的应用ID
APP_KEY = '2ea9d5aecfc'
# 您的应用密钥
APP_SECRET = 'e0TqlHxT4sD5cZxQERTwgD'
# 合成音频保存路径, 例windows路径:PATH = "C:\\tts\\media.mp3"
PATH = 'C:\\Users\\23274\\Desktop\\new1\\'
files=[]
def read_file_2list(file):
file1=docx.Document(file)
Str = ''
for para in file1.paragraphs:
Str+=para.text
#判断文档是英文还是中文,英文分割.结尾不超过1000。中文。分割不超过330
list=[]
sp={
"en": ".","zh": "。"}
lang={
"en": 500,"zh": 330}
#index = random.randrange(len(Str)) # 随机生成一个下标
if len(Str[random.randint(0,len(Str))].encode('utf-8'))==