- Key and Imports In this cheat sheet, we use the following shorthand: arr | A NumPy Array object You’ll also need to import numpy to get started: import numpy as np Importing/exporti... Key and Imports In this cheat sheet, we use the following shorthand: arr | A NumPy Array object You’ll also need to import numpy to get started: import numpy as np Importing/exporti...
- # 字符串是不可变类型 s = "pig" """ id(s) Out[18]: 4355286776 """ s = "cat" """ id(s) Out[20]: 4324273488 """ # 字符串赋值 a = "apple" b = "apple" a == b # Out[13]: True a is b # Out[12]: True id(a)... # 字符串是不可变类型 s = "pig" """ id(s) Out[18]: 4355286776 """ s = "cat" """ id(s) Out[20]: 4324273488 """ # 字符串赋值 a = "apple" b = "apple" a == b # Out[13]: True a is b # Out[12]: True id(a)...
- flake8 是 pep8(检查代码风格) 文档: doc: https://flake8.pycqa.org/pypi: https://pypi.org/project/flake8/github: http://github.com/pycqa/flake8/ 安装 pip install flake8 1 使用 # 检查文件 $ flake8 dem... flake8 是 pep8(检查代码风格) 文档: doc: https://flake8.pycqa.org/pypi: https://pypi.org/project/flake8/github: http://github.com/pycqa/flake8/ 安装 pip install flake8 1 使用 # 检查文件 $ flake8 dem...
- github: https://github.com/python-trio/trio 文档: https://trio.readthedocs.io/en/latest/tutorial.html An async/await-native I/O library for humans and snake people 安装 pip install trio 1... github: https://github.com/python-trio/trio 文档: https://trio.readthedocs.io/en/latest/tutorial.html An async/await-native I/O library for humans and snake people 安装 pip install trio 1...
- 访问类属性的顺序: getattribute -> 如果没有找到属性,则引发异常AttributeError -> AttributeError 异常会触发 getattr,如果没有实现getattr 则抛出异常 123 代码示例 # -*- coding: utf-8 -*- class Dog(object): def __getattrib... 访问类属性的顺序: getattribute -> 如果没有找到属性,则引发异常AttributeError -> AttributeError 异常会触发 getattr,如果没有实现getattr 则抛出异常 123 代码示例 # -*- coding: utf-8 -*- class Dog(object): def __getattrib...
- 一个ThreadLocal变量虽然是全局变量,但每个线程都只能读写自己线程的独立副本,互不干扰。ThreadLocal解决了参数在一个线程中各个函数之间互相传递的问题。 代码示例 # -*- coding: utf-8 -*- # @File : thread_local_demo.py # @Date : 2018-06-11 # @Author : Peng... 一个ThreadLocal变量虽然是全局变量,但每个线程都只能读写自己线程的独立副本,互不干扰。ThreadLocal解决了参数在一个线程中各个函数之间互相传递的问题。 代码示例 # -*- coding: utf-8 -*- # @File : thread_local_demo.py # @Date : 2018-06-11 # @Author : Peng...
- 相关: Python编程:json模块和pickle模块 # -*- coding: utf-8 -*- # @File : json_demo.py # @Date : 2018-06-04 # @Author : Peng Shiyu # 定制序列化或反序列化的规则 import json class Student(object): def __init... 相关: Python编程:json模块和pickle模块 # -*- coding: utf-8 -*- # @File : json_demo.py # @Date : 2018-06-04 # @Author : Peng Shiyu # 定制序列化或反序列化的规则 import json class Student(object): def __init...
- 表单扩展 Flask-WTF 文档: https://flask-wtf.readthedocs.io/en/stable/ 安装 pip install Flask-WTF 1 可以进行csrf验证 代码示例 1、定义模型类 视图使用 from flask import ( Flask, render_template, session, url_fo... 表单扩展 Flask-WTF 文档: https://flask-wtf.readthedocs.io/en/stable/ 安装 pip install Flask-WTF 1 可以进行csrf验证 代码示例 1、定义模型类 视图使用 from flask import ( Flask, render_template, session, url_fo...
- 推荐一个Chrome浏览器的xpath解析工具: xPath helper 轻松获取HTML元素的xPath 打开/关闭控制台:Ctrl-Shift键-X 参考:介绍一款chrome爬虫网页解析工具-XPath Helper scrapy基本介绍 # 创建工程 scrapy startproject myspider # 创建爬虫 scrapy ge... 推荐一个Chrome浏览器的xpath解析工具: xPath helper 轻松获取HTML元素的xPath 打开/关闭控制台:Ctrl-Shift键-X 参考:介绍一款chrome爬虫网页解析工具-XPath Helper scrapy基本介绍 # 创建工程 scrapy startproject myspider # 创建爬虫 scrapy ge...
- PyPI: https://pypi.org/project/jsmin/ Github: https://github.com/tikitu/jsmin 安装 pip install jsmin 1 使用示例 myfile.js function foo() { console.log('hi') } 123 1、命令行中使用 $ python -m j... PyPI: https://pypi.org/project/jsmin/ Github: https://github.com/tikitu/jsmin 安装 pip install jsmin 1 使用示例 myfile.js function foo() { console.log('hi') } 123 1、命令行中使用 $ python -m j...
- MySQL文档:https://dev.mysql.com/doc/connector-python/en/ PYPI: https://pypi.org/project/mysql-connector-python/ mysql-connector-python 是MySQL官方的Python语言MySQL连接模块 安装 $ pip install mysql-... MySQL文档:https://dev.mysql.com/doc/connector-python/en/ PYPI: https://pypi.org/project/mysql-connector-python/ mysql-connector-python 是MySQL官方的Python语言MySQL连接模块 安装 $ pip install mysql-...
- flask的uwsig.ini配置文件如下: [uwsgi] socket = 127.0.0.1:3031 wsgi-file = flask_web.py callable = app processes = 4 threads = 2 stats = 127.0.0.1:9191 12345678 启动 $ uwsgi uwsig.ini1 然后报错: ... flask的uwsig.ini配置文件如下: [uwsgi] socket = 127.0.0.1:3031 wsgi-file = flask_web.py callable = app processes = 4 threads = 2 stats = 127.0.0.1:9191 12345678 启动 $ uwsgi uwsig.ini1 然后报错: ...
- 发现一个比较好玩的模块,测试下: import calendar # 获取日历 cal = calendar.month(2018, 5) print(cal) """ May 2018 Mo Tu We Th Fr Sa Su 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2... 发现一个比较好玩的模块,测试下: import calendar # 获取日历 cal = calendar.month(2018, 5) print(cal) """ May 2018 Mo Tu We Th Fr Sa Su 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2...
- 安装pyinstaller 方式一: pip install pywin32 # 不安装可能会报错 pip install PyInstaller12 方式二: 下载zip文件安装 官网:http://www.pyinstaller.org/ 或者:https://pypi.python.org/pypi/PyInstaller/3.3.1 方式三: ... 安装pyinstaller 方式一: pip install pywin32 # 不安装可能会报错 pip install PyInstaller12 方式二: 下载zip文件安装 官网:http://www.pyinstaller.org/ 或者:https://pypi.python.org/pypi/PyInstaller/3.3.1 方式三: ...
- # -*- coding: utf-8 -*- # 从网络地址中解析出系统文件路径 from urlparse import urlparse #py2版本, py3不一样 from os.path import basename, dirname, join url = "https://matplotlib.org/_downloads/font_file.p... # -*- coding: utf-8 -*- # 从网络地址中解析出系统文件路径 from urlparse import urlparse #py2版本, py3不一样 from os.path import basename, dirname, join url = "https://matplotlib.org/_downloads/font_file.p...
上滑加载中
推荐直播
-
码道新技能,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月份产品特性,通过“特性解读+实操演示+实战案例+设计创新”的组合,全方位展现码道在多会话并行与多智能体协作方面的能力,赋能开发者提升效率
正在直播
热门标签