flask|启动开发服务器的3种方法

方法一 调用Flask实例的run方法,然后直接运行程序即可 1 2 3 4 5 6 7 8 9 10 11 from flask import Flask app = Flask(__name__) @app.route('/') def index(): return '<h1>The server is on!</h1>' if __name__ == '__main__': app.run() 如果要开启debug模式,只需把run方法的debug参数修改为True 1 2 if __name__ == '__main__': app.run(debug=True) 方法二 .py文件里只需如下 1 2 3 4 5 6 7 from flask import Flask app = Flask(__name__) @app.route('/') def index(): return '<h1>The server is on!</h1>' 在命……

阅读全文

mysql中int、bigint、smallint、tinyint的区别介绍

bigint 存储大小为8个字节。每个字节8个2进制位,所以能表示2^64个整数,范围是-2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807)。 int int的同义词为integer。存储大小为4个字节。每个字节8个2进制位,所以能表示2^32个整数,从 -2^31 (-2,147,483,648) 到 2^31 – 1 (2,147,483,647……

阅读全文

力扣题解|第178场周赛

本文是力扣第128场双周赛的题解分享。 第一题. 有多少小于当前数字的数字 考察知识点 数据结构:数组、哈希表 解题思路 维护一个哈希表,用来储存每个num和它的排序(注意并列的情况) 代码 1 2 3 4 5 6 7 8 9 10 11 12 13 class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: nums2 = sorted(nums) // 对nums排序 mapping = {} // mapping储存num和其序号……

阅读全文