Pythonトレーニング


4-3-1-2 文字列の消去

①lstrip

w_str = "   hello   "
new_str = w_str.lstrip()
print(new_str)
->'hello   '

②strip

w_str = "   hello   "
new_str = w_str.lstrip()
print(new_str)
->'   hello'

③rstrip

w_str = "   hello   "
new_str = w_str.lstrip()
print(new_str)
->'hello'