কম্পিউটার টিউটোরিয়াল

পাইথনে ট্রিপল কোটস (Triple Quotes)

পাইথনের ট্রিপল কোটস স্ট্রিংকে একাধিক লাইনে ছড়িয়ে লেখার সুযোগ দেয়, যেখানে নিউলাইন, ট্যাব এবং অন্যান্য স্পেশাল ক্যারেক্টার যেনের তেনে থাকে।

সিনট্যাক্স: তিনটি ক्रमাগত সিঙ্গেল বা ডাবল কোটস।

উদাহরণ

#!/usr/bin/python
para_str = """this is a long string that is made up of several lines and non-printable characters such as TAB ( \t ) and they will show up that way when displayed. NEWLINEs within the string, whether explicitly given like this within the brackets [ \n ], or just a NEWLINE within the variable assignment will also show up. """
print para_str

আউটপুট

this is a long string that is made up of several lines and non-printable characters such as TAB ( ) and they will show up that way when displayed. NEWLINEs within the string, whether explicitly given like this within the brackets [ ], or just a NEWLINE within the variable assignment will also show up.

র স্ট্রিং-এ ব্যাকস্ল্যাশ স্পেশাল ক্যারেক্টার হিসেবে বিবেচিত হয় না।

র স্ট্রিং উদাহরণ

#!/usr/bin/python
print 'C:\\nowhere'

আউটপুট

C:\nowhere
#!/usr/bin/python
print r'C:\\nowhere'

আউটপুট

C:\\nowhere
  1. পাইথনে কোটেশন (Quotation in Python)

  2. পাইথনে স্ট্রিং রোটেশন যাচাই

  3. পাইথনে স্ট্রিং রিভার্স (ইন-প্লেস)

  4. পাইথনে casefold() স্ট্রিং মেথড