You are on page 1of 3

import os

import re
import codecs
test = r'‫'الرحمن‬
with codecs.open('G:\Computer\Python-‫\القرآن الكريم‬Quraan Ma-Mushkoool.txt', 'r','utf-
8') as sentence:
repeat=0
for words in sentence:
#print (words)
pattern=re.compile(test)
matches=pattern.finditer(words)
for match in matches :
repeat+=1
#print(match)

print("‫ "(تكرر التركيب‬,test,")",repeat,'‫)'مرة‬

'''
import os
import codecs
file=codecs.open('G:\Computer\Python-‫\القرآن الكريم‬Quraan Mushkoool2.txt', 'r','utf-8')

sura= file.read() #while harf:


words=sura.split() #words=words(1:)
#print(words)
s = u"‫"ال‬

for x in words :
while s ==True :
print(m)
print(x)
else:
print()
#for s in x:
# print(x)
#for i in range(len(s)):
# print("[", s[i], "]", sep="", end="")

for i in range(len(s)):
print("[", s[i], "]", sep="", end="")
#print() Print newline

for ch in s:
print("<", ch, ">", sep="", end="")
#print() # Print newline

m=(u"‫ "ال‬, "utf-8")


for x in words:
if x==m:
print(x)

else:
print("word not found")

#print (x)
#for word in sp:
# print ("____________",word,"____________")
# for num in range(286):
# if num==word:
# print ("This is the number of the aya")
# else :
# print (word)'''

#input ("press any key to exit")

'''

import os
import pyarabic.arabrepr as arabrepr
arepr=arabrepr.ArabicRepr()
repr=arepr.repr
harf="‫"دجحخهعغفقثصطكنتالبيسشظزوةىلرؤءئ‬
print (harf.split())
klma="‫الرحمن‬,"
count=0
rep=0
with open('G:\Computer\Python-‫\القرآن الكريم‬Quraan Mushkoool2.txt', encoding='utf-8') as
words:

#while harf:
for x in words:
sp=x.split()
for word in sp:
#print ("____________",word,"____________")
for num in range():
if num==word:
print ("This is the number of the aya")
else :
print (word)

#input ("press any key to exit")

for num in range(1,286):


if num==word:
print ("This is the number of the aya"
if word==klma:
count=count+1
print (word ,"repeated ",count,"times")
else:
print(klma,"does not match with", word)
for m in word :
for y in harf:
if y==m:
rep=rep+1
print("‫" الحرف‬,y," ‫" تكرر‬,rep,"‫)"مرة‬
# else:
# print ("No match foound")'''

You might also like