[python] strip


[python] strip

strip : 문자열의 중간 공백은 나두고 앞 뒤의 공백, \t, \n 을 모두 지워줌 str.strip() 선행과 후행 문자가 제거된 문자열의 복사본을 돌려줍니다. chars 인자는 제거할 문자 집합을 지정하는 문자열입니다. 생략되거나 None 이라면, chars 인자의 기본값은 공백을 제거하도록 합니다. chars 인자는 접두사가 아닙니다. 모든 값 조합이 제거 됩니다. str.strip([chars]) >>> ex_str = " hello " >>> ex_str.strip() # 'hello' >>> 'http://www.example.com'.strip('m') # 'http://www.example.co' >>> 'http://www.example.com'.strip('w') # '.exampl..


원문링크 : [python] strip