Files
freeCodeCamp/guide/arabic/python/string-methods/string-find-method/index.md
Randell Dawson d6a160445e Convert single backtick code sections to triple backtick code sections for Arabic Guide articles (13 of 15) (#36240)
* fix: converted single to triple backticks13

* fix: added prefix

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: removed language in wrong place

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add language postfix

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: removed language in wrong place

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
2019-06-20 18:07:24 -05:00

33 lines
1.2 KiB
Markdown

---
title: String Find Method
localeTitle: طريقة البحث عن سلسلة
---
## طريقة البحث عن سلسلة
هناك خياران للعثور على سلسلة فرعية داخل سلسلة في Python ، `find()` و `rfind()` .
كل سوف يعود الموقف الذي تم العثور على سلسلة فرعية في. الفرق بين الاثنين هو أن `find()` ترجع الموضع الأدنى ، و `rfind()` ترجع أعلى موضع.
يمكن توفير وسيطات البدء والانتهاء الاختيارية للحد من البحث عن السلسلة الفرعية داخل أجزاء من السلسلة.
مثال:
```shell
>>> string = "Don't you call me a mindless philosopher, you overweight glob of grease!"
>>> string.find('you')
6
>>> string.rfind('you')
42
```
إذا لم يتم العثور على السلسلة الفرعية ، يتم إرجاع -1.
```shell
>>> string = "Don't you call me a mindless philosopher, you overweight glob of grease!"
>>> string.find('you', 43) # find 'you' in string anywhere from position 43 to the end of the string
-1
```
معلومات اكثر:
[وثائق](https://docs.python.org/3/library/stdtypes.html#string-methods) طرق سلسلة.