Importing PyQuran

Note that PyQuran is imported by a lowercase name.

import pyquran as q
  • Quran retrieving tools are in q.quran.

get_sura

get_sura(sura_number, with_tashkeel=False, basmalah=False)

returns a sura as a list of verses.

Args

  • sura_number: 1 <= Integer <= 114, the ordered number of sura in Mushaf.

  • with_tashkeel: Boolean, if true return sura with tashkeel else return without.

  • basmalah: Boolean, adding basmalah as aya.

Returns

  • [str]: a list of sura's ayat.

Note

Index statrts at zero. So if the order number of an aya is x, then it's at (x-1) in the returned list.

Example

   q.quran.get_sura(108, with_tashkeel=True)

   >>> ['إِنَّا أَعْطَيْنَكَ الْكَوْثَرَ', 'فَصَلِّ لِرَبِّكَ وَانْحَرْ', 'إِنَّ شَانِئَكَ هُوَ الْأَبْتَرُ']

get_verse

get_verse(sura_number, verse_number, with_tashkeel=False)

get specific verse form specific chapter

Args

  • sura_number: 1 <= Integer <= 114, the ordered number of sura in Mushaf.

  • verse_number: Integer > 0, number of verse.

  • with_tashkeel: Boolean, if true return sura with tashkeel else return without.

Returns

  • str: a verse.

Example

q.quran.get_verse(sura_number=1, verse_number=2)

>>> 'الحمد لله رب العلمين'

get_sura_number

get_sura_number(sura_name)

Args

sura_name (str) : string represents the sura name.

Returns

  • int: the sura number which name is sura_name.

Note

Do not forget that the index of the returned list starts at zero. So if the order Sura number is x, then it's at (x-1) in the list.

Example

pq.quran.get_sura_number('الملك')

>>> 67

get_sura_name

get_sura_name(sura_number=None)

Returns the name of sura_number. If sura_number=None a list of all sura's names is retunred.

Args

  • sura_number: Optional, 1 <= Integer <= 114, the ordered number of sura in Mushaf.

Returns

  • str: the sura name which number is sura_number.

  • [srt]: list of all suras' names (if the sura_number parameter is None).

Example

q.quran.get_sura_name(2)

>>> 'البقرة'