- 开启文件服务器 # 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...
- 装饰器: 定义:本质是函数,装饰其他函数,为其他函数添加附加功能 原则: 1、不能修改被装饰的函数源代码 2、不能修改被装饰的函数的调用方式 原理: 1.函数即“变量” 2.高阶函数 a.把函数名当做实参传递给函数b.返回一个函数名 3.嵌套函数 总结: 高阶函数 + 嵌套函数 =》 装饰器 import time def timer(arg): # 可以接... 装饰器: 定义:本质是函数,装饰其他函数,为其他函数添加附加功能 原则: 1、不能修改被装饰的函数源代码 2、不能修改被装饰的函数的调用方式 原理: 1.函数即“变量” 2.高阶函数 a.把函数名当做实参传递给函数b.返回一个函数名 3.嵌套函数 总结: 高阶函数 + 嵌套函数 =》 装饰器 import time def timer(arg): # 可以接...
上滑加载中
推荐直播
-
华为云码道-玩转OpenClaw,在线养虾2026/03/11 周三 19:00-21:00
刘昱,华为云高级工程师/谈心,华为云技术专家/李海仑,上海圭卓智能科技有限公司CEO
OpenClaw 火爆开发者圈,华为云码道最新推出 Skill ——开发者只需输入一句口令,即可部署一个功能完整的「小龙虾」智能体。直播带你玩转华为云码道,玩转OpenClaw
回顾中 -
华为云码道-AI时代应用开发利器2026/03/18 周三 19:00-20:00
童得力,华为云开发者生态运营总监/姚圣伟,华为云HCDE开发者专家
本次直播由华为专家带你实战应用开发,看华为云码道(CodeArts)代码智能体如何在AI时代让你的创意应用快速落地。更有华为云HCDE开发者专家带你用码道玩转JiuwenClaw,让小艺成为你的AI助理。
回顾中 -
Skill 构建 × 智能创作:基于华为云码道的 AI 内容生产提效方案2026/03/25 周三 19:00-20:00
余伟,华为云软件研发工程师/万邵业(万少),华为云HCDE开发者专家
本次直播带来两大实战:华为云码道 Skill-Creator 手把手搭建专属知识库 Skill;如何用码道提效 OpenClaw 小说文本,打造从大纲到成稿的 AI 原创小说全链路。技术干货 + OPC创作思路,一次讲透!
回顾中
热门标签