Skip to main content

BOJ Offline Judge

Project description

Codacy Badge Shields Badge - PyPI/version Shields Badge - PyPI/license Shields Badge - PyPI/downloads Shields Badge - PyPI/status GitHub/issues

BOJ Offline Judge

개요

BOJ-Offline-Judge는 백준 온라인 저지를 CLI, 혹은 Python 스크립트를 통해 이용 하기 위해 제작한 API 입니다.

BOJ는 간단한 JSON혹은 Python의 딕셔너리 형태의 문제 데이터를 제공합니다.

BOJProblem

boj.BOJProblem() 객체를 이용하여 문제 데이터에 접근할 수 있습니다.

인스턴스 생성

객체의 인스턴스는 다음과 같이 생성합니다.

>>> from boj import BOJProblem
>>> problem = BOJProblem(1000)

Args:

  • number: (int) 필수; 문제의 번호입니다.

프로퍼티

현재 사용할 수 있는 프로퍼티에는 다음의 값들이 있습니다.

  • problem_id: (int) 문제의 번호
  • problem_lang: (int) 문제의 언어 (0: 한국어, 1: 영어)
  • title: (str) 문제의 제목
  • description: (str) 문제의 내용 (HTML 문서)
  • input: (str) 문제의 입력 설명 (HTML 문서)
  • output: (str) 문제의 출력 설명 (HTML 문서)
  • hint: (str) 문제의 힌트 (HTML 문서)

예시 코드

다음은 boj 모듈을 사용하여 1000번 A+B 문제 데이터를 불러오는 예시 코드 입니다.

>>> from boj import BOJProblem

>>> problem = BOJProblem(1000)

>>> print(problem.problem_id)
1000

>>> print(problem.title)
'A+B'

>>> print(problem.data)
[{'problem_id': '1000', 'problem_lang': '0', 'title': 'A+B', 'description': '<p>두 정수 A와 B를 입력받은 다음, ...', ... }, ... ]

>>> print(problem.json)
b'[{"problem_id": "1000", "problem_lang": "0", "title": "A+B", "description": "<p>\\ub450 \\uc815\\uc218 ...'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boj-0.0.2a0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

boj-0.0.2a0-py3-none-any.whl (16.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page