728x90
반응형
✔ gpt입력 내용 :
Python에서 QR 코드를 생성하는 코드 작성해줘
import qrcode
def generate_qr_code(data, filename):
qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=4)
qr.add_data(data)
qr.make(fit=True)
qr_image = qr.make_image(fill_color="black", back_color="white")
qr_image.save(filename)
data = "https://www.example.com"
filename = "qr_code.png"
generate_qr_code(data, filename)
✔ gpt입력 내용 :
Python에서 QR 코드를 생성하는 코드를 작성합니다. 04.QR코드 생성기 폴더에 저장되도록 이미지 파일이 저장되는 위치를 적어줘
import qrcode
import os
def generate_qr_code(data, filename):
qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=4)
qr.add_data(data)
qr.make(fit=True)
qr_image = qr.make_image(fill_color="black", back_color="white")
output_dir = "04.QR code generator"
os.makedirs(output_dir, exist_ok=True)
output_path = os.path.join(output_dir, filename)
qr_image.save(output_path)
print(f"QR code image saved at: {output_path}")
data = "https://www.example.com"
filename = "qr_code.png"
generate_qr_code(data, filename)
✔ gpt입력 내용 :
04. QR 코드 생성기 폴더의 qrdata.txt 파일에서 데이터를 QR 코드로 만든다. 04.QR코드 생성기 폴더에 저장되도록 이미지 파일이 저장되는 위치를 적어줘
import psutil
import time
def monitor_system():
while True:
cpu_percent = psutil.cpu_percent(interval=1)
ram_usage = psutil.virtual_memory().percent
network_stats = psutil.net_io_counters()
network_sent = network_stats.bytes_sent
network_recv = network_stats.bytes_recv
print(f"CPU Usage: {cpu_percent}%")
print(f"RAM Usage: {ram_usage}%")
print(f"Network Sent: {network_sent} bytes")
print(f"Network Received: {network_recv} bytes")
print("")
time.sleep(1)
monitor_system()

반응형
'Chatgpt' 카테고리의 다른 글
Chatgpt 이용한 프로그램 짜기 6 - 파이썬 환율 변환기 (0) | 2023.07.27 |
---|---|
Chatgpt 이용한 프로그램 짜기 5 - 파이썬(CPU, RAM, 네트워크 사용량) (0) | 2023.07.19 |
Chatgpt 이용한 프로그램 짜기 3 - 파이썬(텍스트 음성변환) (0) | 2023.07.17 |
Chatgpt 이용한 프로그램 짜기 2 - 파이썬(내부 ,외부 IP 찾기) (0) | 2023.07.16 |
Chatgpt 이용한 프로그램 짜기 1 - 파이썬(숫자맞추기게임) (0) | 2023.07.15 |