파이썬 문자열 lstrip() 메서드
예시
문자열 왼쪽의 공백을 제거합니다.
txt = " banana "
x =
txt.lstrip()
print("of all fruits", x, "is my favorite")
정의 및 사용
이 lstrip()
메서드는 선행 문자를 제거합니다(공백은 제거할 기본 선행 문자입니다).
통사론
string.lstrip(characters)
매개변수 값
Parameter | Description |
---|---|
characters | Optional. A set of characters to remove as leading characters |
더 많은 예
예시
선행 문자 제거:
txt = ",,,,,ssaaww.....banana"
x = txt.lstrip(",.asw")
print(x)