详情

全站展示位

wtforms 使用的一些问题总结 | Leetao's Blog

Q&A Q1. 用IntegerField来限制form只能用数字 但是发现它只能接受1以上 不能接受0 如何设置 A1:添加代码validators=[InputRequired()] Q2. 让 IntegerField 的输入框只允许输入数字,即选渲染后的输入框类型为 number A2: 添加代码widget=NumberInput(), 引入 from wtforms。。。

推荐

Anaconda Navigator启动失败 | Leetao's Blog

我的最终启动失败的原因是:No Module named ‘pywintypes’ 缺失引起的 Anaconda Navigator 启动失败,但是解决问题的方法是通用的. 定位问题找到应用,点击打开文件位置 右键快捷方式,将箭头所在栏的内容复制下来 你会得到类似如下的命令: pathto\Anaconda3\pythonw.exe pathoto\Anaconda3\cwp.py pathto

wtforms 使用的一些问题总结 | Leetao's Blog

Q&A Q1. 用IntegerField来限制form只能用数字 但是发现它只能接受1以上 不能接受0 如何设置 A1:添加代码validators=[InputRequired()] Q2. 让 IntegerField 的输入框只允许输入数字,即选渲染后的输入框类型为 number A2: 添加代码widget=NumberInput(), 引入 from wtforms

偏函数-functools之partial | Leetao's Blog

前段时间在讲述 Flask-Login 的源码中遇见了一个函数 ——partial,这个函数来自于functools模块,这个模块定义为”The functools module is for higher-order functions: functions that act on or return other functions. In general, any callable objec

心灵鸡汤

  三国时期,东吴名臣陆绩乘船渡河,遇到大风浪,需要东西压船,陆绩身无长物,更没有钱财等,最终只寻得一块巨石,度过了风浪。

  这块“压舱石”如今还矗立在苏州古城内文庙府学明伦堂前,石面正中刻有“廉石”两个大字,左下方落款:“赐进士弟,文林郎巡按直隶苏松等府监察御史河南胙城樊祉立,弘治九年,岁在丙辰夏六月吉旦。”

  廉石承载了郁林太守陆绩为官清廉、为民造福的高尚品质。

列表展示

主站展示位

Merge Intervals | Leetao's Blog

Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. Solution 两个区间(A,B)能合并,说明这 A.end >= B.start and A.start

Number of Boomerangs | Leetao's Blog

Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tu

py2app 打包相关问题 | Leetao's Blog

前言最近一直在研究用 py2app 给自己写的 PyQt5 应用打包应用,在打包过程中遇到了一次问题,写在这里备忘一下。 问题问题一 AttributeError: module ‘string’ has no attribute ‘maketrans’ 这个问题从网上查找了一下发现好像是 PyQt 的问题,但是到现在也没有被修复。 解决方法:修复起来也很简单,由于出问题的地方在 ascii_up

ImportError- unable to find Qt5Core.dll on PATH | Leetao's Blog

前言今天在 windows 下打包 PyQt5 应用出现了 ImportError: unable to find Qt5Core.dll on PATH 错误,搜索了一下找到以下解决办法 解决办法使用 –path 参数由于我们打包出错的原因是缺少 Qt5Core.dll,所以在打包过程中,指定路径。使用方法如下 1pyinstaller --path path_to_\Python\Lib\si

Longest Harmonious Subsequence | Leetao's Blog

We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer array, you need to find the length of its longest harm

Island Perimeter | Leetao's Blog

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely

Counting Sort | Leetao's Blog

前言 In computer science, counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by countin

基于 Ajax 请求的 Flask-Login 认证 | Leetao's Blog

index.htmlexample.py 12345678910111213141516171819202122## index.html```index.html<!DOCTYPE html><html> <head> <title> test login by Leetao</title> </head

Set Matrix Zeroes | Leetao's Blog

给定一个 m x n 的矩阵,如果一个元素为 0,则将其所在行和列的所有元素都设为 0。请使用原地算法。 示例 1: 输入: [ &nbsp;&nbsp;&nbsp;&nbsp;[1,1,1], &nbsp;&nbsp;&nbsp;&nbsp;[1,0,1], &nbsp;&nbsp;&nbsp;&nbsp;[1,1,1]]输出:[ &nbsp;&nbsp;&nbsp;&nbsp;[1,

context_processor 上下文处理器 | Leetao's Blog

前言写专栏写了一段时间了,但是一直都没有带大家做一个完整的小项目,俗话说的好,“光说不练假把式,光练不说真把式,连说带练全把式”,自然我要当仁不让做“全把式”了,然后自己就偷偷摸摸的花了几天时间撸了一个博客,功能暂时没有全部完成,完成后会写一个教程教大家从零开始撸一个自己的博客,博客地址:

python内置常量(built-in constants)-NotImplemented | Leetao's Blog

定义NotImplemented 的在标准库的定义如下: Special value which should be returned by the binary special methods (e.g. eq() , lt(), add(), rsub(), etc.) to indicate that the operation is not implemented with respec

python内置常量(built-in constants)-NotImplemented | Leetao's Blog

定义NotImplemented 的在标准库的定义如下: Special value which should be returned by the binary special methods (e.g. eq() , lt(), add(), rsub(), etc.) to indicate that the operation is not implemented with respec

Isomorphic Strings | Leetao's Blog

Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another ch

Set Mismatch | Leetao's Blog

The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of o

Runtime.getRuntime().exec -- Cannot run program CreateProcess error=2, The system cannot find the file specified | Leetao's Blog

问题原因最近有个需求用Java调用nginx -V并返回输出,查了一下决定使用Runtime.getRuntime().exec()去执行命令.代码如下: 1process = Runtime.getRuntime().exec(cmd, null, dir); 最初调用函数将正确路径和cmd都传入进去,其中cmd为nginx -V,但是返回下列错误: Cannot run program “

Island Perimeter | Leetao's Blog

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely

Distribute Candies | Leetao's Blog

Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute these

Longest Harmonious Subsequence | Leetao's Blog

We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer array, you need to find the length of its longest harm

Contains Duplicate II | Leetao's Blog

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k.

博客寄语:

    一个爱折腾的90后,喜欢写有趣的代码,做有趣的事

实时播报:

博客号-学习成长

相信每一分耕耘都有每一分收获,致力帮助博客主所创作的博客能更快的被收录! 如果有其它需求,可联系下方邮箱。