
[Python] Concurrency PDF 파일 생성 - 2
·
Python/Python
PDF 파일 생성 PDF 파일 생성은 비동기 I/O 작업이다. 평벙하고 쉽게 누구나처럼 그냥 함수 혹은 클래스 작성해서 반복문으로 구현할 수도 있지만, 정말로 업무가 급하고 그런게 아니라고 한다면, 빠르게 동작을 할 수 있도록 하자. Sample Data와 Package import random import uuid from threading import Thread from faker import Faker from fpdf import FPDF fake = Faker() class Person: # slots는 Class attr에 빠른 접근 및 제어, 적은 메모리 사용에 이점이 있다. __slots__ = ['name', 'age', 'location'] def __init__(self, name:..