728x90
컴머로 구분된 string에서 공백을 없애고 array로 바꾸는 문법입니다.
코드
temp = "one, two, three, four"
temp = temp.replace(" ", "")
temp2 = temp.split(",")
결과
temp2[0]: one
temp2[1]: two
temp2[2]: three
temp3[3]: four
728x90
'python > 문법' 카테고리의 다른 글
파이썬 클립보드에 스트링 넣기 빼기 (0) | 2023.09.02 |
---|---|
파이썬 스트링 자르는 법 (0) | 2023.09.02 |
파이썬 try except (0) | 2023.06.06 |
Python에서 Jason File 처리 (0) | 2022.12.21 |
hello world (0) | 2022.04.17 |