In [13]: db = DataBase(1, "192.168.2.11") In [14]: db.__dict__ Out[14]: {'id': 1, 'address': '192.168.2.11'} In [16]: db["id"] Out[16]: 1 In [17]: db["cxs"] Out[17]: '100'
_file_
获取当前文件的完整路径
1 2 3 4 5
In [75]: !type cxs.py print(__file__)
In [76]: %run cxs.py C:\Users\chen_xiaosheng\Desktop\cxs.py