상세 컨텐츠

본문 제목

슬라이씽

python

by bumychoi 2024. 7. 5. 17:00

본문


# 문자 슬라이씽

in_str ="Suppose we have few words that are separated by spaces."

li =in_str.split(" ")
print(li)
count= len(li)
print(count)

# 예제
txt2 =input()
b=txt2.split('&',3)

print(b)
print(f'ex2결과:{b}')

['Suppose', 'we', 'have', 'few', 'words', 'that', 'are', 'separated', 'by', 'spaces.']
10
a&b&c&d&f
['a', 'b', 'c', 'd&f']
ex2결과:['a', 'b', 'c', 'd&f']

'python' 카테고리의 다른 글

파일 쓰기  (1) 2024.07.05
파일에서 스플릿하기  (1) 2024.07.05
전역변수 & 지역변수  (0) 2024.07.05
지역변수  (0) 2024.07.05
전역변수  (0) 2024.07.05

관련글 더보기