Python文字列rstrip
lstrip

rstrip文字列

split

末尾の空白(または指定した文字)を除去します。

構文

str.rstrip(chars?)

使用例

下記の値を入力するとサンプルに即時反映されます。

print
rstrip
text = "  hello world  "
print(text.rstrip())  # "  hello world"