목록분류 전체보기 (17)
Be Data
보호되어 있는 글입니다.
보호되어 있는 글입니다.
리스트의 모든 조합 구하는 방법에는 3가지가 있음 product permutations combinations 하나의 리스트에서 모든 조합을 구할 때, permutations, combinations 사용 from itertools import permutations from itertools import combinations items = ['a','b','c'] list(permutations(items,2)) # [('a','b'),('a','c'),('b','a'),('b','c'),('c,'a'),('c'..
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..
보호되어 있는 글입니다.
보호되어 있는 글입니다.
보호되어 있는 글입니다.