공부/Python

공부/Python

자주쓰는 Python 명령어

string 관련 str.lower() -> string 전체 소문자로 변경 str.upper() -> string 전체 대문자로 변경 str[0].isupper() -> str[0] 대문자 여부 str.replace("python","java") -> python을 java로 변경 index = str.index("n") -> string에서 문자 n의 인덱스 index = str.index("n",index+1) -> 첫번째 n의 인덱스 이후의 다음 n의 인덱스 str.find("java") -> 있으면 1 없으면 -1 리턴 str.count("n") -> string에서 "n"의 갯수 list 관련 list.index(value) -> list에서 value가 있는 index list.append(..

poujis
'공부/Python' 카테고리의 글 목록