IT/Python
파이썬_문자열 관련 함수를 사용해보자!
IamSusan
2023. 3. 12. 00:05
문자열
[함수]
1. len: 문자의 길이 확인
2. split: 문장 쪼개기
3. replace: 내용 변경
4. lower: 소문자 변경
5. upper: 대문자 변경
6. startwith: ~로 시작하는
7. endswith: ~로 끝나는
8. strip: 앞, 뒤 불필요한 공백 제거
Q. a='banana pen' 문자 길이는?
Q. a='This is a pen' 문장을 쪼개시오.
Q. a='This is a pen' 각각 다른 리턴값으로 출력
Q. This와 is의 값을 합치시오.
Q. 아래의 문장을 단어 단위로 나누시오.(하이픈은 제외)
"A 61-year-old man whose wife worked as O'Connell's housekeeper was charged with one count of murder in the shooting death of the much lauded religious leader."
Q. My name is Teddy 소문자로 변경
Q. My name is Teddy 대문자로 변경
Q. a의 값이 01로 시작하는지 확인
a의 값이 .jpg로 끝나는지 확인
a='01-sample.png'
b='02-sample.jpg'
c='03-sample.pdf'
Q. if조건 활용하여 b번 출력
Q. a='01-sample.png' png를 jpg로 변경
Q. a=' 01-sample.png' 불필요한 공백 제거