zoukankan      html  css  js  c++  java
  • DAY 42 前端

     

    json序列化

    import json
    from datetime import date,datetime


    class MyJsonEncoder(json.JSONEncoder):
       def default(self, o):
           # o其实就是我们即将要序列化的对象
           if isinstance(o,date):
               return o.strftime('%Y-%m-%d')
           if isinstance(o,datetime):
               return o.strftime('%Y-%m-%d %X')
           return o

    d = {'time1':date.today(),'time2':datetime.today()}
    res = json.dumps(d,cls=MyJsonEncoder)
    print(res)
    """
    TypeError: Object of type date is not JSON serializable
    """

    面试题

    class Context:
       def __enter__(self):
           print('嘿嘿嘿')
           return self
       def __exit__(self, exc_type, exc_val, exc_tb):
           print('呵呵呵')
       def do_something(self):
           pass
    with Context() as obj:
       print('哈哈哈')
       print(obj)

    jQuery

    1.使用js文件存储
    2.html文件需要先导入才能使用
    3.jQuery使用$代替,增加书写简易度

    CDN

    内容分发网络

    常用选择器

    • 基本选择器

    • 组合选择器

  • 相关阅读:
    javascript定义
    JavaScript学习笔记
    PostgreSQL数据库配置
    python 时间戳转时间 timestamp to time
    WebGIS:Vue+Flask+PostGIS+Geoserver开发环境配置
    GeoServer环境配置
    Vue前端环境配置
    Flask后端环境配置
    1.顺序表
    汇编语法--AT&T VS. intel
  • 原文地址:https://www.cnblogs.com/DEJAVU888/p/14893452.html
Copyright © 2011-2022 走看看