freeCodeCamp/guide/arabic/python/escape-sequences/index.md

1.9 KiB

title localeTitle
Python Escape Sequences بيثون الهروب التسلسل

يمكن العثور على قائمة بتسلسلات الهروب هنا

تسمح تتابعات الهروب بإدراج حروف خاصة في سلاسل.

`>>> print('Single quote strings can have 'single' quotes if they are escaped') "Single quote strings can have 'single' quotes if they are escaped"

print("Double quote strings can have "double" quotes if they are escaped") 'Double quote strings can have "double" quotes if they are escaped' print("Multiline strings\ncan be created\nusing escape sequences.") Multiline strings can be created using escape sequences. print("Backslashes \ need to be escaped.") Backslashes \ need to be escaped. `

يمكن استخدام سلسلة أولية عن طريق إدخال السلسلة مع r أو R التي تسمح بتضمين الخطوط المائلة العكسية دون الحاجة إلى الهروب منها -

`>>> print(r"Backslashes \ don't need to be escaped in raw strings.") Backslashes \ don't need to be escaped in raw strings.

print(r"An odd number of backslashes at the end of a raw string will cause an error") File "", line 1 print(r"An odd number of backslashes at the end of a raw string will cause an error") ^ SyntaxError: EOL while scanning string literal. `

# بعض الأمثلة الإضافية من تسلسلات الهروب. تسلسل الهروب
\ يطبع Backslash
`يطبع واحد الاقتباس
\ "يطبع الاقتباس المزدوج
\ a جرس ASCII يجعل رنين أصوات تنبيه الجرس (على سبيل المثال. xterm) \ b ASCII backspace (BS) يزيل الحرف السابق \ n يضيف السطر الجديد.