Notice
Recent Posts
Recent Comments
Link
목록StringSplit (1)
SeouliteLab
[Python/파이썬] String split()으로 문자열 나누는 방법
Python에서는 문자열을 특정 구분자를 기준으로 나누는 데에 유용한 split() 메서드를 제공합니다. split() 메서드를 사용하면 문자열을 리스트로 분할할 수 있습니다. 이를 통해 여러 개의 부분 문자열로 나눌 수 있습니다. 1. 기본적인 사용법 split() 메서드를 사용하여 문자열을 공백을 기준으로 나누는 예제입니다. # 기본적인 split() 메서드 사용 예제 sentence = "Hello world, this is a test" words = sentence.split() print(words) # 출력 결과: ['Hello', 'world,', 'this', 'is', 'a', 'test'] 위의 예제에서는 문자열 "Hello world, this is a test"를 공백을 기준으로 ..
프로그래밍
2024. 3. 1. 16:01