[Python] String 위치 별 공백 없애기 (strip, replace, re)


[Python] String 위치 별 공백 없애기 (strip, replace, re)

목차 [Python] String 공백 없애기 (split()함수) Syntax string.strip(characters) 위 Syntax에서 처럼 string 내용 중에 제거하고 싶은 글자를 characters에 넣으면 됩니다. default 은 blank(빈칸입니다.) strip으로 공백을 제거할 경우 문장 사이는 제거가 안되고 양끝만 제거 됩니다. 예제 코드>> string_ex = " Hi My Name is John " print(string_ex.strip()) 결과>> Hi My Name is John [Python] String 공백 없애기 (replace()함수) Syntax string.replace(oldvalue, newvalue, count) oldvalue에는 바꾸고자 하는 내..


원문링크 : [Python] String 위치 별 공백 없애기 (strip, replace, re)