본문 바로가기

Python_Beginer/Study

(78)
Pycharm 한글 에러 발생 해결 방안 Issue>1. Pycharm에서 한글로 출력시 에러가 발생 하거나 글씨가 깨지는 현상이 벌어짐2. 한글 인코딩 문제 발생 Solutions>1. Pycharm Settuings 변경 방법1-1. File > Settings 1-2. Editor > File Encodings > project Encoding > Default encoding for properties fileUTF-8 로 변경 후 Pycharm 종료 후 재시작 2. 코드창 윗부분에 아래 해당 주석 추가#-*- coding: utf-8 -*-
Python Operator(연산자) Code># 각 변수에 할당 한 후 사칙연산 a = 1 b = 2 c = a + b print(c) print('-' * 10) # 사칙연산을 변수로 직접 지정 print(a - b) print(a * b) print(a / b) print('-' * 10) # 나눗셈 print(6 / 3) print('-' * 10) # 몫 print(10 // 3) print('-' * 10) # 제곱 print(3 ** 5) print('-' * 10) # 단항 연산자 a = 1 a += 100 a *= 10 a //= 3 a %= 5 print(a) print('-' * 10) # 비교 연산자 print(100 == 50) print(100 != 50) print(100 >= 50) print(100 < 50) ..
Python Variable(변수) Code># 정수형 변수 a = 1 b = -2 print(a) print(b) # 실수형 변수 c = 1.2 d = -3.45 print(c) print(d) # 지수형 변수 e = 4.24e10 f = 4.24e-10 print(e) print(f) # 8진수 변수 g = 0o177 print(g) # 16진수 변수 h = 0xABC print(h) # 복소수 i = 1 + 2j print(i) Result>1-21.2-3.4542400000000.04.24e-101272748(1+2j) Process finished with exit code 0 정리>1. 변수1-1. 표현법 : 변수이름 = 값1-2. 우변에서 좌변으로 대입1-3. 규칙1-3-1. 영어 / 숫자 / 언더바의 조합으로 정의1-3-2...
Python Remark(주석문) Code>''' hello world! Life is too short, You need Python ''' # 화면에 출력 print('Hello, World') Result>Hello, World Process finished with exit code 0 정리>1. 주석문?1-1. 프로그램 코드 안에서 개발자 필요에 따라 명시하는 설명문. 1-2. 주석문은 프로그램 실행시 제외 처리 됨. 1-3. 특정 코드 부분이 실행 안되게 테스트 할때도 사용. 2. 주석문 종류2-1. 기본 주석문 : ## 주석문 2-2. 여러줄 처리 주석문 : ''' ~ '''''' 주석문 ''' 2-3. 여러줄 처리 주석문 : """ ~ """""" 주석문 """
PyCharm Community Edition Setup 1. PyCharm Setup Down1-1. Site : https://www.jetbrains.com/pycharm/download/#section=windows 2. License2-1. Site : https://www.jetbrains.com/store/terms/comparison.html#LicenseComparison 2. Setup Guide2-1. Setup ※ 32bit / 64bit 둘다 설치, .py확장자는 파이참으로 열기 2-2. 초기 셋팅 ※ PyCharm 기본 테마 선택 : Black / White 나중에 변경 가능(커스터마이징 가능함) ※ 추가로 설치할 것 선택(Python 이므로 아무것도 체크 안하고 넘어감) ※ Create New Project를 눌러 사용가능 3. 프로..
Python Basic Setup 1. Python Setup Down 1-1. Site : https://www.python.org/downloads/release/python-373/ 1-2. OS 따른 Ver DownloadWindows -> Windows x86-64 executable installerMAC -> macOS 64-bit/32-bit installer 2. Setup Guide ※ Add Python 3.7 to PATH에 반드시 체크 / 환경변수를 설정 / 수동으로도 설정 가능함 3. 실행 TEST3-1. cmd(시작 -> 명령프롬프트 or cmd) 3-2. python ※ python 이 안되면 Add Python 3.7 to PATH에 미체크 후 설치 진행한 것임. 4. 환경 변수 수동 설정4-1. 제어판 >..
Python Basic 1. Python Setup Ver 확인1-1. Windows(명령 프롬프트)python --version1-2. Mac(터미널)python3 --version 2. Python Site2-1. Python 공식 사이트 : https://www.python.org/2-2. Python Code 확인 : http://pythontutor.com/ 3. Python Setup Option3-1. Install launcher for all users / Add Python 3.7 to PATH 4. Python Run4-1. Windows(명령 프롬프트)python4-2. MAC(터미널)python3 5. Python extension.py 6. Python Code Run6-1. Windows(명령 프롬프..
Python - Class1 ~ 3까지의 첨부파일을 읽어들여서 한 파일로 만들기(부제. 평균) class1 ~ 3의 파일은 각 각의 내용을 가지고 있다.이것을 한 개의 파일로 만들어보고 평균을 구해서 추가하자. import csv students = [] for num in range(1, 4): filename = "class{}.csv".format(num) file = open(filename, "r") csvfile = csv.reader(file) for item in csvfile: sum = 0 for score in item[1:]: sum += int(score) avg = sum / (len(item) - 1) item.append(avg) students.append(item) file = open("students1.csv", "w", newline = "")..