Files
freeCodeCamp/guide/arabic/python/string-methods/string-join-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

1.5 KiB
Raw Blame History

title, localeTitle
title localeTitle
String Join Method طريقة الانضمام إلى سلسلة

طريقة الانضمام إلى سلسلة

يتم استخدام أسلوب str.join(iterable) جميع العناصر في iterable مع str سلسلة محددة. إذا احتوى المتغير على أي قيم غير سلسلة ، فإنه يؤدي إلى رفع استثناء TypeError.

iterable : كل iterables من السلسلة. يمكن أن تكون قائمة من السلاسل ، مجموعة من السلسلة أو حتى سلسلة بسيطة.

أمثلة

  1. الانضمام إلى ist من السلاسل مع ":"
print ":".join(["freeCodeCamp", "is", "fun"])

انتاج |

freeCodeCamp:is:fun
  1. الانضمام إلى مجموعة من الأوتار مع " and "
print " and ".join(["A", "B", "C"])

انتاج |

A and B and C
  1. أدخل " " بعد كل حرف في سلسلة
print " ".join("freeCodeCamp")

انتاج:

free C ode C amp

  1. الانضمام مع سلسلة فارغة.

list1 = ['p','r','o','g','r','a','m'] print("".join(list1))

انتاج:

program
  1. الانضمام مع مجموعات.
test =  {'2', '1', '3'}
s = ', '
print(s.join(test))

انتاج:

2, 3, 1

معلومات اكثر:

وثائق بيثون على سلسلة الانضمام