1. 사용법
'구분자'.join(반복 가능한 객체)
2. 예시
words = ['Python', 'is', 'fun']
sentence = ' '.join(words)
print(sentense) #출력: Python is fun
fruits = ('apple','banana', 'cherry')
result = ', '.join(fruits)
print(result) #출력: apple, banana, cherry
letters = ['H','e','l','l','l'o']
word = ''.join(letters)
print(word) #출력: Hello
3. 주의사항
join() 메서드를 사용할 때, 반복 가능한 객체(iterable)의 모든 요소는 문자열 이어야 함map() 함수를 사용하여 요소들을 문자열로 변환 가능numbers = [1,2,3]
result = '-'.join(map(str, numbers))
print(result) #출력: 1-2-3join() 메서드는 문자열 메서드이므로, 구분자는 반드시 문자열이어야 함