Guidelines

λ¬Έμžμ—΄μ„ κ²°ν•©ν•˜λŠ” join ν•¨μˆ˜

join() ν•¨μˆ˜λŠ” μ—¬λŸ¬ λ¬Έμžμ—΄μ„ ν•˜λ‚˜λ‘œ κ²°ν•©ν•  λ•Œ μ‚¬μš©ν•©λ‹ˆλ‹€.

νŠΉμ • κ΅¬λΆ„μž(Delimiter)λ₯Ό μ‚¬μš©ν•˜μ—¬ λ¬Έμžμ—΄, 리슀트, νŠœν”Œ λ“± 반볡 κ°€λŠ₯ν•œ 객체의 μš”μ†Œλ“€μ„ μ—°κ²°ν•©λ‹ˆλ‹€.

join ν•¨μˆ˜ μ‚¬μš©λ²•
'κ΅¬λΆ„μž'.join(λ°˜λ³΅κ°€λŠ₯ν•œκ°μ²΄)

join() ν•¨μˆ˜ μ‚¬μš© μ˜ˆμ‹œ

join() ν•¨μˆ˜λŠ” κ²°ν•©ν•  λ¬Έμžμ—΄λ“€μ„ ν¬ν•¨ν•œ 반볡 κ°€λŠ₯ν•œ 객체λ₯Ό λ§€κ°œλ³€μˆ˜(ν•¨μˆ˜λ₯Ό μ‹€ν–‰ν•˜κΈ° μœ„ν•΄ ν•„μš”ν•œ μž…λ ₯κ°’)둜 λ°›μŠ΅λ‹ˆλ‹€.

이 ν•¨μˆ˜λŠ” λ¬Έμžμ—΄μ˜ 각 μš”μ†Œ 사이에 μ§€μ •λœ κ΅¬λΆ„μžλ₯Ό μ‚½μž…ν•΄ ν•˜λ‚˜μ˜ λ¬Έμžμ—΄λ‘œ κ²°ν•©ν•©λ‹ˆλ‹€.

join ν•¨μˆ˜ μ˜ˆμ‹œ
words = ['즐거운', '파이썬', 'ν”„λ‘œκ·Έλž˜λ°'] sentence = ' '.join(words) print("sentence:", sentence) # "즐거운 파이썬 ν”„λ‘œκ·Έλž˜λ°"

join() ν•¨μˆ˜λŠ” μ—¬λŸ¬ 개의 λ¬Έμžμ—΄μ„ ν•˜λ‚˜λ‘œ κ²°ν•©ν•˜κ±°λ‚˜, 리슀트 λ˜λŠ” νŠœν”Œμ„ λ¬Έμžμ—΄λ‘œ λ³€ν™˜ν•  λ•Œ μ‚¬μš©ν•©λ‹ˆλ‹€.

리슀트λ₯Ό λ¬Έμžμ—΄λ‘œ λ³€ν™˜
words = ['apple', 'banana', 'cherry', 'date', 'fig'] word_joined = ', '.join(words) print("word_joined:", word_joined)
Mission
0 / 1

λ¬Έμžμ—΄ κ²°ν•©ν•˜κΈ°

주어진 리슀트의 λ¬Έμžμ—΄λ“€μ„ ' - ' κ΅¬λΆ„μžλ‘œ κ²°ν•©ν•˜μ—¬ 좜λ ₯ν•˜μ„Έμš”. μ˜ˆμƒ 좜λ ₯값은 Hello - World - Pythonμž…λ‹ˆλ‹€.

words = ['Hello', 'World', 'Python']

result = ' - '.join(
)

print(result)

Guidelines

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Execution Result