import json
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z']
count = 0
for i in alphabet:
with open(f'stuff/{str(i)}_stuff.json') as file:
value = json.load(file)
count += len(value)
print(count)
import json
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z']
for i in alphabet:
with open(f'stuff/{str(i)}_stuff.json') as file:
value = json.load(file)
for j in range(0, len(value)):
my_string = value[str(j)][0]
tts = gTTS(text=my_string, lang='en')
tts.save(f'mp3/{my_string}.mp3')
print(i, j)
sleep(30)
import os.path
import json
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z']
for i in alphabet:
with open(f'stuff/{str(i)}_stuff.json') as file:
value = json.load(file)
for j in range(0, len(value)):
my_string = value[str(j)][0]
check = os.path.isfile(f'mp3/{my_string}.mp3')
if check == True:
print(f'{j}:{value[str(j)][0]} - Есть {my_string}.mp3')
continue
else:
print(f'{i}:{j} - {check}')
print('Отправляю запрос...')
tts = gTTS(text=my_string, lang='en')
tts.save(f'mp3/{my_string}.mp3')
print('Успешно')