import json
with open("C:/Users/Mustafa Abbas/Desktop/projects/quran/data.json", "r") as file:
json_data = file.read()
data = json.loads(json_data)
inp = int(input("Enter the surah number :"))
i = inp - 1
verses_text = [ayah['text'] for ayah in data['data']['surahs'][i]['ayahs']]
with open("text.txt", "w") as f:
for verse_text in verses_text:
f.write(verse_text + "\n")
6
1April 5, 2024 5.1K 19