-
[split/join] string to list, list to string카테고리 없음 2022. 7. 19. 07:20
문장등을 다룰때 자주 쓰이는 메소드
# split string by character sentence = "hello how are you" l = sentence.split() # split the sentence by space print(l) # ["hello", "how", "are", "you"] # merge element in list s = "".join(l) print(s) # "hellohowareyou" s2 = " ".join(l) print(s2) # "hello how are you"