-
[Python] 파이썬 문자열 나누는 함수: split(),split(` `)차이
split(), split(‘ ‘) split 함수는 문자열을 쪼개서 리스트로 만드는 함수입니다. split() , split(‘ ‘) 둘 다 띄어쓰기를 기준으로 문자열을 나눈다는 공통점이 있습니다. 하지만 두 함수 사이에는 차이점이 있습니다.이번 포스트에서는 split() , split(‘ ‘)의 차이점과 두 함수 가 각각 어떤 방식으로 작동하는지 알아보겠습니다. ※ split 함수에 대해 알고 싶다면 아래 “split 함수 정리하기” 링크를 클릭하세요. split 함수 정리하기 split(), split(‘ ‘)함수의 작동방식 앞서 설명한 것 처럼 split(), split(‘ ‘) 은 띄어쓰기를 기준으... Read More
-
[Python] 파이썬 개발환경 설정2
1. 사이트 접속 https://www.jetbrains.com/ko-kr/pycharm/download Pycharm 사이트에 접속해서 오른쪽에 있는 community버전을 다운로드 합니다. 2. Pycharm 설치 다운로드한 Pycharm-community.exe파일을 실행합니다. “Next” 클릭합니다. “Next” 클릭합니다. 이 부분은 선택사항입니다. 다 도움이 되는 옵션이라 저는 전부 선택하겠습니다. 내용을 간단히 설명하겠습니다. Create Desktop Shortcut 바탕화면에 파이참 바로가기 만들기 ... Read More
-
[Python] 파이썬 개발환경 설정1
Windows 에서 파이썬 설치하기 1.운영체제 bit 확인 먼저 컴퓨터의 운영체제가 64-bit 인지 32-bit 인지 확인해야 합니다.(대부분 오래된 컴퓨터가 아니라면 64비트 입니다.)</span> 아래 링크 들어가서 운영체제 bit를 확인합니다. ※링크: 운영체제 비트 확인하기 2. 파이썬 설치 아래 링크로 들어가서 파이썬 최신 버전을 다운로드 합니다. https://www.python.org/downloads/windows/ 사진에 노란색 형광펜으로 표시했습니다. 버전에 맞게 Windows installer 를 설치합니다. (저는 당시 최신 버전인 3.11.2 설치했습니다. ... Read More
-
[Python] 파이썬 replace 함수 정리하기
replace함수 정의 replace 함수는 문자열 안에 있는 특정 문자열을 변경하는 함수입니다. replace함수 용도 replace 함수는 문자열을 변경할 때 사용합니다. replace 함수 사용법 “문자열”.replace(“Old”,”New”,”Count”) Old: 변경하고 싶은 문자열 New: 변경한 뒤의 문자열 Count: 문자열 변경 횟수 ※ “Count” 매개 변수는 선택사항이며 “Count” 매개변수를 지정하지 않으면 자동으로 최댓값으로 지정됩니다(문자열 전체 변경). replace 함수 예시 예시1: “Hello” → “Hi” name = "Hello my name is skytin... Read More
-
[Python] 파이썬 sum 함수 정리하기
sum 함수 정의 sum함수는 리스트 원소들의 총합을 구하는 함수입니다. ※sum 함수는 리스트 뿐만 아니라 딕셔너리, 튜플 등 반복가능한 개체를 인자로 받을 수 있습니다. sum 함수 사용법 sum(“리스트”) ※sum 함수에 들어오는 리스트의 원소들은 전부 ‘숫자’로 이루어져있어야 합니다. sum 함수 예시 예시1: 숫자로 이루어진 리스트 number= [1,2,3,4,5,6] result = sum(number) print(result) 실행결과 21 예시2: 숫자로 이루어진 튜플 number= (1,2,3,4,5,6) result = sum(number) print(result) 실... Read More