生成XML文件 import sys class BuildNewXML(): # 自定义建立XML文件类 def __init__(self,filename = None): self.filename = filename self.__get_f = None # 自定义隐含属性(类内部使用 ...
分类:
其他好文 时间:
2020-05-25 22:15:59
阅读次数:
78
自定制过滤器 1、在项目目录下,创建一个templatetags文件夹(必须这样命名) 2、在templatetags文件夹下年创建xx.py文件(随意命名,但是要具有描述性) 3、在xx.py文件中引用tempate模块,并创建注册器 from django import template?reg ...
分类:
其他好文 时间:
2020-05-25 19:52:57
阅读次数:
79
```swift // // ViewController10.swift // swiftT // // Created by wjwdive on 2020/5/25. // Copyright © 2020 wjwdive. All rights reserved. // import UIK... ...
分类:
编程语言 时间:
2020-05-25 17:49:38
阅读次数:
86
``` python #定义一个类Student class Student(object): pass #给类增加一个属性name Student.name = 'xm' print Student.name # xm #给类增加一个方法set_age def set_age(self,age):... ...
分类:
编程语言 时间:
2020-05-25 15:24:25
阅读次数:
72
最近在使用python+appium做APP自动化的时候,需要获取验证码,测试环境有验证码开关,打开时会自动填入验证码,但是这样和实际使用场景还是有差距,于是想从数据库直接获取验证码,数据库用的是Mysql,一下是我使用数据库获取验证码的步骤,希望对小伙伴有帮助 测试界面如下: 首先,需要连接数据库 ...
分类:
移动开发 时间:
2020-05-25 15:16:17
阅读次数:
105
```python # -*- coding:utf8 -*- import os class BatchRename(): """ 批量重命名文件夹中的图片文件 """ def __init__(self): self.path = 'D:\MyData\zhaohz4\Desktop\MIdea... ...
分类:
其他好文 时间:
2020-05-25 09:45:10
阅读次数:
59
暴力法: 思路: 从数组下标1开始遍历到n-1,每当遍历一个元素时,分别寻找到当前元素开始左边和右边的最大值,用最大值中较小值减去当前元素值即为当前位置所能接到的雨水量,加入到结果res中,遍历完成后res即为接到雨水总量。 代码: class Solution: def trap(self, he ...
分类:
其他好文 时间:
2020-05-24 16:43:12
阅读次数:
50
翻转一棵二叉树。 示例: 输入: 4/ \2 7/ \ / \1 3 6 9输出: 4/ \7 2/ \ / \9 6 3 1 python # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): ...
分类:
其他好文 时间:
2020-05-24 13:56:30
阅读次数:
47
# 树的单个结点 class Node: def __init__(self,elem): # 结点数据 self.elem = elem # 左子树和右子树 self.lchild = None self.rchild = None # 二叉树的实现 class my_tree: # 初始化空树 ...
分类:
其他好文 时间:
2020-05-24 13:46:26
阅读次数:
51
一、序列化和反序列化 ``` #coding=utf-8from django.http import HttpResponsefrom django.views import Viewimport jsonpickle class User(object): def __init__(self,u ...
分类:
其他好文 时间:
2020-05-24 11:34:28
阅读次数:
96