Viết mã Python dễ bảo trì thông qua một ví dụ
Chúng ta cùng tìm hiểu cách viết mã Python dễ bảo trì thông qua một ví dụ cụ thể.
Ví dụ từ trường hợp thực tế
import json
import urllib.request
def get(endpoint, student):
result = None
try:
info1 = urllib.request.urlopen(f"{endpoint}/student/{student}/")
if info1.status_code == 200:
result1 = json.loads( ...
Đăng vào ngày 21 tháng 5 lúc 16:37