Python string rjust() method

ইনস্ট্যান্স

Returns the 20-character right-aligned version of the word "banana":

txt = "banana"
x = txt.rjust(20)
print(x, "is my favorite fruit.")

রান ইনস্ট্যান্স

note:The result is, the left side of the word "banana" actually has 14 spaces.

definition and usage

rjust() method uses the specified character (default is space) as the padding character to right-align the string.

syntax

string.rjust(length, character)

parameter value

parameter description
length অপরিহার্য। ফলাফলকার স্ট্রিংর দৈর্ঘ্য
character অপশনাল। অপূর্ণ জায়গা (স্ট্রিংর ডানদিকে) পূরণ করার জন্য অক্ষর ব্যবহার করা হবে। ডিফল্ট মান " " (খালি)।

আরও ইনস্ট্যান্স

ইনস্ট্যান্স

পূলক অক্ষর "O" হিসাবে ব্যবহার করুন:

txt = "banana"
x = txt.rjust(20, "O")
print(x)

রান ইনস্ট্যান্স