김학진
@mildsalmon
·
흔치않고, 진귀하다.

카테고리

[Document] OS

OS 모듈은 파이썬을 설치할 때 자동으로 설치되는 파이썬 라이브러리에 포함된다. 그리고 환경 변수나 디렉토리, 파일 등의 OS 자원을 제어할 수 있게 해주는 모듈입니다. 현재 작업 폴더 얻기 os.getcwd()를 사용하여 얻습니다. (get current working directory) print(os.getcwd()) # D:\source\test 디렉토리 변경 os.chdir(path)를 사용합니다. (path는 문자열이어야함.) os.chdir("C:\WINDOWS") print(os.getcwd()) # C:\WINDOWS 시스템 명령어 호출하기 …

2020년 02월 17일 · 8 min read

[Document] Requests

간단한 Requests 예시 r = requests.get('https://api.github.com/user', auth=('user', 'pass')) print(r.status_code) print(r.headers['content-type']) print(r.encoding) print(r.text) print(r.json()) # 403 # application/json; charset=utf-8 # utf-8 # {"message":"Maximum number of login attempts exceeded. Please try again later.","documentation_url":"https://developer.github.com/v3"} # {'message': 'Maximum number of login attempts exceeded. Please try again later.', 'documentation_url': 'https://developer.github.com/v3'} r.status_code 는 .get 부분에 auth=에 …

2020년 02월 15일 · 35 min read