- TinyDB 是一个轻量级的文档数据库,操作类似MongoBD,其存储方式为Json 文档:https://tinydb.readthedocs.io/en/latest/index.html github:https://github.com/msiemens/tinydb 代码示例 # -*- coding: utf-8 -*- from tinydb im... TinyDB 是一个轻量级的文档数据库,操作类似MongoBD,其存储方式为Json 文档:https://tinydb.readthedocs.io/en/latest/index.html github:https://github.com/msiemens/tinydb 代码示例 # -*- coding: utf-8 -*- from tinydb im...
- 开启文件服务器 # python2 python -m SimpleHTTPServer # python3 python3 -m http.server # 指定端口,默认8000 python3 -m http.server 8080 # 指定ip python3 -m http.server 8080 --bind 127.0.0.1 # 指定目录 py... 开启文件服务器 # python2 python -m SimpleHTTPServer # python3 python3 -m http.server # 指定端口,默认8000 python3 -m http.server 8080 # 指定ip python3 -m http.server 8080 --bind 127.0.0.1 # 指定目录 py...
- python的管理工具太多了,是谁说的python解决一个问题只用一个方式来着? 工具介绍原理参考pip包管理工具文章virtualenv虚拟环境管理工具切换目录文章virtualenvwrapper虚拟环境管理工具加强版文章pyenvpython版本管理工具修改环境变量文章pyenv-virtualenv虚拟环境管理工具文章pipenv项目环境管理工具文章pipxP... python的管理工具太多了,是谁说的python解决一个问题只用一个方式来着? 工具介绍原理参考pip包管理工具文章virtualenv虚拟环境管理工具切换目录文章virtualenvwrapper虚拟环境管理工具加强版文章pyenvpython版本管理工具修改环境变量文章pyenv-virtualenv虚拟环境管理工具文章pipenv项目环境管理工具文章pipxP...
- numpy.random随机函数 rand(d0, d1,...dn) 随机数组, 浮点数,[0, 1)均匀分布 randn(d0, d1,...dn) 随机数组,正态分布 randint(low, high, shape) 指定随机范围 seed(s) 随机种子 shuffle(a) 随机排列第一轴, 改变数组a permutation(a) 根据第一轴返回乱序数组... numpy.random随机函数 rand(d0, d1,...dn) 随机数组, 浮点数,[0, 1)均匀分布 randn(d0, d1,...dn) 随机数组,正态分布 randint(low, high, shape) 指定随机范围 seed(s) 随机种子 shuffle(a) 随机排列第一轴, 改变数组a permutation(a) 根据第一轴返回乱序数组...
- 算法Algorithm 一个计算过程,解决问题的方法 递归: 调用自身结束条件 时间复杂度: 用来估计算法运行时间的一个式子 O(1) < O(logn) < O(n) < O(nlogn) < O(n^2) < O(n2logn) < O(n^3)一般来说,时间复杂度高的算法比复杂度低的算法慢不常见的时间复杂度: O(... 算法Algorithm 一个计算过程,解决问题的方法 递归: 调用自身结束条件 时间复杂度: 用来估计算法运行时间的一个式子 O(1) < O(logn) < O(n) < O(nlogn) < O(n^2) < O(n2logn) < O(n^3)一般来说,时间复杂度高的算法比复杂度低的算法慢不常见的时间复杂度: O(...
- Key and Imports In this cheat sheet, we use the following shorthand: df | Any pandas DataFrame object s | Any pandas Series object You’ll also need to perform the following imports t... Key and Imports In this cheat sheet, we use the following shorthand: df | Any pandas DataFrame object s | Any pandas Series object You’ll also need to perform the following imports t...
- 说明: render是get方式 execute是post方式 render import requests def splash_render(url): splash_url = "http://localhost:8050/render.html" args = { "url": url, "timeout": 5, "image": 0, "proxy":... 说明: render是get方式 execute是post方式 render import requests def splash_render(url): splash_url = "http://localhost:8050/render.html" args = { "url": url, "timeout": 5, "image": 0, "proxy":...
- Pony is an advanced object-relational mapper 文档: PyPI: https://pypi.org/project/pony/Github: https://github.com/ponyorm/ponydoc: https://docs.ponyorm.org/ 安装 pip install pony 1 代码实例... Pony is an advanced object-relational mapper 文档: PyPI: https://pypi.org/project/pony/Github: https://github.com/ponyorm/ponydoc: https://docs.ponyorm.org/ 安装 pip install pony 1 代码实例...
- 原理: 1个进程 -> 多个子进程 -> scrapy进程1 代码示例 将以下代码文件放入scrapy项目中任意位置即可 # -*- coding: utf-8 -*- # @File : run_spider.py # @Date : 2018-08-06 # @Author : Peng Shiyu from multiprocessing... 原理: 1个进程 -> 多个子进程 -> scrapy进程1 代码示例 将以下代码文件放入scrapy项目中任意位置即可 # -*- coding: utf-8 -*- # @File : run_spider.py # @Date : 2018-08-06 # @Author : Peng Shiyu from multiprocessing...
- SSH:安全外壳协议 SSH: Secure Shell Protocol 安全外壳协议(SSH)是一种在不安全网络上提供安全远程登录及其它安全网络服务的协议。 说明:以下代码使用windows访问linux(centos) 安装第三方库 pip install paramiko 1 1. SSHClient方式 1.1 基于用户名和密码 imp... SSH:安全外壳协议 SSH: Secure Shell Protocol 安全外壳协议(SSH)是一种在不安全网络上提供安全远程登录及其它安全网络服务的协议。 说明:以下代码使用windows访问linux(centos) 安装第三方库 pip install paramiko 1 1. SSHClient方式 1.1 基于用户名和密码 imp...
- 问题来了 使用 reduce() 测试的时候报错:reduce 未定义! print(reduce(lambda x, y: x + y, [ 1, 2, 3])) """Output: NameError: name 'reduce' is not defined """12345 解决 引用stackoverflow的回答: - 你使用的是pyth... 问题来了 使用 reduce() 测试的时候报错:reduce 未定义! print(reduce(lambda x, y: x + y, [ 1, 2, 3])) """Output: NameError: name 'reduce' is not defined """12345 解决 引用stackoverflow的回答: - 你使用的是pyth...
- # -*-coding:utf-8-*- html = """ <html> <head> <base href='http://example.com/' /> <title>Example website</title> </head> <body> <di... # -*-coding:utf-8-*- html = """ <html> <head> <base href='http://example.com/' /> <title>Example website</title> </head> <body> <di...
- 文件结构 ./ |--main.py |--clazz |--demo.txt 12345 获取clazz包下面的demo.txt文件 main.py import pkgutil ret = pkgutil.get_data("clazz", "demo.txt") print(ret) 12345 此方法替换__file__ 文件结构 ./ |--main.py |--clazz |--demo.txt 12345 获取clazz包下面的demo.txt文件 main.py import pkgutil ret = pkgutil.get_data("clazz", "demo.txt") print(ret) 12345 此方法替换__file__
- 一层装饰器 # -*- coding: utf-8 -*- def func1(func): print("func1-1") def inner1(): print("inner1-1") func() print("inner1-2") print("func1-2") return inner1 @func1 def func(): print("fun... 一层装饰器 # -*- coding: utf-8 -*- def func1(func): print("func1-1") def inner1(): print("inner1-1") func() print("inner1-2") print("func1-2") return inner1 @func1 def func(): print("fun...
- from timeit import timeit from timeit import repeat # 执行1000000次x=1的时间 t1 = timeit("x=1") print("t1", t1) # x=1的执行时间,执行1次(number可以省略,默认值为1000000) t2 = timeit('x=1', number=1) print("t2... from timeit import timeit from timeit import repeat # 执行1000000次x=1的时间 t1 = timeit("x=1") print("t1", t1) # x=1的执行时间,执行1次(number可以省略,默认值为1000000) t2 = timeit('x=1', number=1) print("t2...
上滑加载中
推荐直播
-
HDC深度解读系列 - Serverless与MCP融合创新,构建AI应用全新智能中枢2025/08/20 周三 16:30-18:00
张昆鹏 HCDG北京核心组代表
HDC2025期间,华为云展示了Serverless与MCP融合创新的解决方案,本期访谈直播,由华为云开发者专家(HCDE)兼华为云开发者社区组织HCDG北京核心组代表张鹏先生主持,华为云PaaS服务产品部 Serverless总监Ewen为大家深度解读华为云Serverless与MCP如何融合构建AI应用全新智能中枢
回顾中 -
关于RISC-V生态发展的思考2025/09/02 周二 17:00-18:00
中国科学院计算技术研究所副所长包云岗教授
中科院包云岗老师将在本次直播中,探讨处理器生态的关键要素及其联系,分享过去几年推动RISC-V生态建设实践过程中的经验与教训。
回顾中 -
一键搞定华为云万级资源,3步轻松管理企业成本2025/09/09 周二 15:00-16:00
阿言 华为云交易产品经理
本直播重点介绍如何一键续费万级资源,3步轻松管理成本,帮助提升日常管理效率!
回顾中
热门标签