- 算法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...
- 装饰器: 定义:本质是函数,装饰其他函数,为其他函数添加附加功能 原则: 1、不能修改被装饰的函数源代码 2、不能修改被装饰的函数的调用方式 原理: 1.函数即“变量” 2.高阶函数 a.把函数名当做实参传递给函数b.返回一个函数名 3.嵌套函数 总结: 高阶函数 + 嵌套函数 =》 装饰器 import time def timer(arg): # 可以接... 装饰器: 定义:本质是函数,装饰其他函数,为其他函数添加附加功能 原则: 1、不能修改被装饰的函数源代码 2、不能修改被装饰的函数的调用方式 原理: 1.函数即“变量” 2.高阶函数 a.把函数名当做实参传递给函数b.返回一个函数名 3.嵌套函数 总结: 高阶函数 + 嵌套函数 =》 装饰器 import time def timer(arg): # 可以接...
- python实现脚本命令行的库有: 内置库sys内置库argparse第三方库click第三方库fire 内置库sys sys.argv 包含命令行参数列表,第一个参数是文件名 sys_demo.py import sys def add(a, b): return a + b if __name__ == '__main__': ret = add(s... python实现脚本命令行的库有: 内置库sys内置库argparse第三方库click第三方库fire 内置库sys sys.argv 包含命令行参数列表,第一个参数是文件名 sys_demo.py import sys def add(a, b): return a + b if __name__ == '__main__': ret = add(s...
- 文档:http://docs.peewee-orm.com/ 安装 $ pip install peewee 1 将已有数据表转为Model # 导出数据表为Model $ python -m pwiz -e mysql -H localhost -p 3306 -u root -P -o -i -t user data > user.py 12 打印执... 文档:http://docs.peewee-orm.com/ 安装 $ pip install peewee 1 将已有数据表转为Model # 导出数据表为Model $ python -m pwiz -e mysql -H localhost -p 3306 -u root -P -o -i -t user data > user.py 12 打印执...
- python 递归调用默认上限:1000次 1、比较运算符: __cmp__(self,other)比较 __eq__(self,other)相等 __lt__(self,other)小于 __gt__(self,other)大于 2、逻辑运算符: __... python 递归调用默认上限:1000次 1、比较运算符: __cmp__(self,other)比较 __eq__(self,other)相等 __lt__(self,other)小于 __gt__(self,other)大于 2、逻辑运算符: __...
上滑加载中
推荐直播
-
码道新技能,AI 新生产力——从自动视频生成到开源项目解析2026/04/08 周三 19:00-21:00
童得力-华为云开发者生态运营总监/何文强-无人机企业AI提效负责人
本次华为云码道 Skill 实战活动,聚焦两大 AI 开发场景:通过实战教学,带你打造 AI 编程自动生成视频 Skill,并实现对 GitHub 热门开源项目的智能知识抽取,手把手掌握 Skill 开发全流程,用 AI 提升研发效率与内容生产力。
回顾中 -
华为云码道:零代码股票智能决策平台全功能实战2026/04/18 周六 10:00-12:00
秦拳德-中软国际教育卓越研究院研究员、华为云金牌讲师、云原生技术专家
利用Tushare接口获取实时行情数据,采用Transformer算法进行时序预测与涨跌分析,并集成DeepSeek API提供智能解读。同时,项目深度结合华为云CodeArts(码道)的代码智能体能力,实现代码一键推送至云端代码仓库,建立起高效、可协作的团队开发新范式。开发者可快速上手,从零打造功能完整的个股筛选、智能分析与风险管控产品。
回顾中 -
华为云码道全新升级,多会话并行与多智能体协作2026/05/08 周五 19:00-21:00
王一男-华为云码道产品专家;张嘉冉-华为云码道工程师;胡琦-华为云HCDE;程诗杰-华为云HCDG
华为云码道4月份版本全新升级,此次直播深度解读4月份产品特性,通过“特性解读+实操演示+实战案例+设计创新”的组合,全方位展现码道在多会话并行与多智能体协作方面的能力,赋能开发者提升效率
正在直播
热门标签