class LabTestRepository:
__list_of_hospital_lab_ids = [ 'L101', 'L102' , 'L102' ]
因为当我使用 LabTestRepository.__list_of_hospital_lab_ids
直接访问它时,出现错误:
AttributeError : type object 'LabTestRepository' has no attribute '__list_of_hospital_lab_ids'
最佳答案
您正在尝试访问类的私有(private)变量。因此你需要做:
LabTestRepository._LabTestRepository__list_of_hospital_lab_ids
关于python - 如何访问和修改 LabTestRepository 类中的 __list_of_hospital_lab_test_ids?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51579559/