I want to take all names from JSON delhi_hos file and store it in String, So that player can play That String. Right Now It plays one by one name. So Suggest Something Please.
JSON Example
[
{
"id": 1,
"name": "JW Marriott Hotel",
"country": "IN"
},
{
"id": 2,
"name": "Le Méridien Hotel",
"country": "IN"
},
{
"id": 3,
"name": "The Leela Palace Hotel",
"country": "IN"
}
]
My Code
if "Hospital".lower() in sentence.lower():
# print("Which City?")
# print("1.Surat \n 2.Pune \n 3.Delhi")
with open("store.txt", 'a') as store:
store.truncate(0)
if element['name'].lower() in sentence.lower():
for items in delhi_hos:
name3 = items.get('name')
print(name3)
my_text = "Near is " + name3
my_obj = gTTS(text=my_text, lang=language, slow=False)
my_obj.save("welcome.mp3")
os.system("mpg123.exe welcome.mp3")
with open("store.txt", "r+") as text_file:
text_file.truncate(0)
and I want Names From JSON file in string Like This
"JW Marriott Hotel Le Méridien Hotel The Leela Palace Hotel"
and the Store it in the variable.
var = "JW Marriott Hotel Le Méridien Hotel The Leela Palace Hotel"
So, I can use var as a input for my player to play this string. My main Problem Is to convert all name into this string.