8
Tại sao sử dụng 'eval' là một thực hành xấu?
Tôi đang sử dụng lớp sau để dễ dàng lưu trữ dữ liệu các bài hát của mình. class Song: """The class to store the details of each song""" attsToStore=('Name', 'Artist', 'Album', 'Genre', 'Location') def __init__(self): for att in self.attsToStore: exec 'self.%s=None'%(att.lower()) in locals() def setDetail(self, key, val): if key …