파이썬[Python]: collections - UserString 클래스
collections 모듈 - UserString 클래스(class)
/// 설명
스트링 객체의 래퍼 처럼 작동하는 클래스입니다. 스트링 객체의 내용을 속성(data attribute)으로서 접근할 수 있기 때문에 사용되어 집니다.
※ 형식
class collections.UserString(initialdata)
※ 형식
class collections.UserString(initialdata)
/// 예제
1 2 3 4 5 6 7 8 9 | import collections test_str = 'This is a string' print(test_str) # This is a string test_ostr = collections.UserString(test_str) print(test_ostr.data) # This is a string print(test_ostr.removeprefix('This ')) # is a string | cs |
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기