목록전체 글 (17)
Be Data
str = "Hello Python" 대문자, 소문자 #변경 str.upper() str.lower() # 여부확인 str.isupper() str.islower() 문자열 영어/숫자 확인 str.isalpha() # False 공백이 존재하므로! str[:5].isalpha()# True "Hello" #숫자 여부 확인 str.isdigit() # 영문자, 숫자 여부 판별 str[:5].isalnum() # True 일부 변경 str.replace("Hello", "Hi") # Hello를 Hi로 변경 str.replace(" ","") # 공백 삭제 문자열 공백/특정문자 제거 str2 = " Hello " str2.strip() #Hello str2.lstrip() #Hello . str2.rstri..
보호되어 있는 글입니다.
2021 카카오 채용연계형 인턴십 > 숫자 문자열과 영단어 문제 https://school.programmers.co.kr/learn/courses/30/lessons/81301 python의 "replace()"를 이용하면 정말 쉽다! replace의 정말 간단한 예로는 a= "Hello, This is BS" a.replace("Hello", "Hi") 이렇게 하면 "Hi, This is BS" 가 출력된다! 따라서, def solution(s): en_list = ["zero","one","two","three","four","five","six","seven","eight","nine"] for i in range(10): s=s.replace(en_list[i],str(i)) return int..