# importing all the functions# from http.server module# * means allfromhttp.serverimport*# creating a class for handling# basic Get and Post RequestsclassGFG(BaseHTTPRequestHandler):# We will create a function# for Get Request using the command belowdefdo_GET(self):# Successful Response --...
list로 주고받기 >>>fromhanspellimportspell_checker>>>spell_checker.check([u'안녕 하세요.',u'저는 한국인 입니다.']) [Checked(result=True,original='안녕 하세요.',checked='안녕하세요.',errors=1,words=OrderedDict([('안녕하세요.'...
from PIL import Image input_img = Image.open("test.jpg") output_img = input_img.save("testNew.jpg", optimize=True, quality=50) input_img_2 = Image.open("testNew.jpg") print("Input image size:", input_img.size) print("Output Image Size:", input_img_2.size) 출력: Input ...
15 from datetime import datetime 16 17 18 19 class SuperError(Exception): 20 21 def __init__(self, message): 22 23 Exception.__init__(message) 24 25 self.when = datetime.now() 26 27 28 29 30 31 raise SuperError('Ummm... something is wrong') Advertisement...
(default: INFO)--channelfile [CHANNELFILE]channel file path (default: Channel.json)--xmlfile [XMLFILE] write output to file if specified--xmlsock [XMLSOCK] send output to unix socket if specified--parallel run in parallel--dbfile [DBFILE] export/import data to/from dbOnline help: <...
from enum import Enum, auto class Skill(Enum): def _generate_next_value_(name, start, count, last_values): return name HTML = auto() CSS = auto() JS = auto()>>> list(Skill) [<Skill.HTML: 'HTML'>, <Skill.CSS: 'CSS'>, <Skill.JS: 'JS'>]...
>>> from functools import wraps >>> def decorate(func): ... @wraps(func) ... def wrapper(*args, **kwargs): ... print("before") ... result = func(*args, **kwargs) ... print("after") ... return result ... return wrapper ... >>> @decorate ... def say_hi(): ......
# Python 3.xfromabcimportABCMeta,abstractstaticmethodclassPerson(metaclass=ABCMeta):@abstractstaticmethoddefperson_type():passclassStudent(Person):def__init__(self,name):self.name=nameprint("Student Created:",name)defperson_type(self):print("Student")classTeacher(Person):def__init__(self,name)...
from sympy import * isprime(8) isprime(11) 출력: False True 음수는 소수 기준에 포함되지 않는다는 점에 유의해야합니다. 이러한 함수의 출력은 음수를 확인하면 달라질 수 있습니다.작...
from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from pathlib import Path from argparse import ArgumentParser def _predeploy(base_url, base_name): """ params: - `base_url: str` e.g. "https://pseudo-lab.github.io" - `base_name: str` e.g. "/cheat-sheet" """ _...