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

    内容分发网络

    常用选择器

    • 基本选择器

    • 组合选择器

  • 相关阅读:
    Splunk数据处理
    使用http://start.spring.io/ 生成工程
    SpringBoot和SpringCloud区别
    Spring Cloud
    Spring Boot
    Splunk大数据分析经验分享
    Splunk和ELK深度对比
    Git 教程
    Docker 教程
    STL中的unique和unique_copy函数
  • 原文地址:https://www.cnblogs.com/DEJAVU888/p/14893452.html
Copyright © 2011-2022 走看看