摘要:
from django.conf import settings print(settings.IP_LOCAL) 阅读全文
摘要:
# coding=utf-8 import sys import os s = 'C:/Users/Desktop/lesson/python/calss1.py' m_dir = os.path.dirname(s) # 输出为 'C:/Users/Desktop/lesson/python' m 阅读全文
摘要:
####问题就是 关联类为空找不到 在或者geattr / hasattr / obj. item 会抛出异常 ####无法通过判断处理 捕获异常 try: tmp_data['demand_dept_name'] = data.demand_dept.name except Exception: 阅读全文
摘要:
as_dict(self, keys=None, exclude_keys=None): """ 将ORM对象序列化为字典 :param keys: :return: """ if not keys: keys = self.output_fields keys += ['add_datetime' 阅读全文
摘要:
import os from datetime import datetime, timedelta path = "." if __name__ == '__main__': for root, firs, files in os.walk(path): for file in files: if 阅读全文