- 源码: #利用字符串和列表将两个通讯录文本合并为一个文本 def main(): ftele1=open('TeleAddressBook.txt','rb') ftele2=open('EmailAddressBook.txt','rb') ... 源码: #利用字符串和列表将两个通讯录文本合并为一个文本 def main(): ftele1=open('TeleAddressBook.txt','rb') ftele2=open('EmailAddressBook.txt','rb') ...
- 面向对象的三个属性: 封装:把功能显示出来,隐藏具体实现代码 继承:python支持多继承 多态:不同的人,对同一事物的不同看法 方法:类的一部分,对象调用的函数 函数:可以直接用函数名调用的代码块 装饰器: @classmethod :调用的时... 面向对象的三个属性: 封装:把功能显示出来,隐藏具体实现代码 继承:python支持多继承 多态:不同的人,对同一事物的不同看法 方法:类的一部分,对象调用的函数 函数:可以直接用函数名调用的代码块 装饰器: @classmethod :调用的时...
- 需要在Nuget安装IronPython, 如果报错,需要更新Nuget版本则下载对应版本即可:https://dist.nuget.org/index.html 添加引用:IronPython.dll,Microsoft.Scripting.dll(在IronPython的安装目录中) c#文件:... 需要在Nuget安装IronPython, 如果报错,需要更新Nuget版本则下载对应版本即可:https://dist.nuget.org/index.html 添加引用:IronPython.dll,Microsoft.Scripting.dll(在IronPython的安装目录中) c#文件:...
- 进制转换的函数 bin() 10进制转2进制oct() 10进制转8进制hex()10进制转16进制int() *进制转10进制 各进制之间转换 ↓2进制8进制10进制16进制2进制-bin(int(x, 8))bin(int(x, 10))bin(int(x, 16))8进制oct(int(x, 2))-oct(int(x, 10))oct(int(x, 16)... 进制转换的函数 bin() 10进制转2进制oct() 10进制转8进制hex()10进制转16进制int() *进制转10进制 各进制之间转换 ↓2进制8进制10进制16进制2进制-bin(int(x, 8))bin(int(x, 10))bin(int(x, 16))8进制oct(int(x, 2))-oct(int(x, 10))oct(int(x, 16)...
- 操作目录及文件 import shutil f1 = open("file.txt", "r", encoding="utf-8") f2 = open("file_new.txt", "w", encoding="utf-8") shutil.copyfileobj(f1, f2) # 通过文件对象拷贝文件内容 shutil.copyfile("file.tx... 操作目录及文件 import shutil f1 = open("file.txt", "r", encoding="utf-8") f2 = open("file_new.txt", "w", encoding="utf-8") shutil.copyfileobj(f1, f2) # 通过文件对象拷贝文件内容 shutil.copyfile("file.tx...
- Flask-Static-Digest 用于处理静态文件 文档:https://github.com/nickjj/flask-static-digest 安装 pip install Flask-Static-Digest 1 使用示例 # -*- coding: utf-8 -*- from flask import Flask, render_temp... Flask-Static-Digest 用于处理静态文件 文档:https://github.com/nickjj/flask-static-digest 安装 pip install Flask-Static-Digest 1 使用示例 # -*- coding: utf-8 -*- from flask import Flask, render_temp...
- 通过一个判断文件是否存在,判断实例是否存在 # -*- coding: utf-8 -*- import atexit import os @atexit.register def remove_lock_file(): if os.path.exists('file.lock'): os.remove('file.lock') def create_loc... 通过一个判断文件是否存在,判断实例是否存在 # -*- coding: utf-8 -*- import atexit import os @atexit.register def remove_lock_file(): if os.path.exists('file.lock'): os.remove('file.lock') def create_loc...
- 文档:https://github.com/pallets/itsdangerous 安装 pip install itsdangerous 1 示例 # -*- coding: utf-8 -*- from itsdangerous import TimedJSONWebSignatureSerializer # jwt auth_s = TimedJSON... 文档:https://github.com/pallets/itsdangerous 安装 pip install itsdangerous 1 示例 # -*- coding: utf-8 -*- from itsdangerous import TimedJSONWebSignatureSerializer # jwt auth_s = TimedJSON...
- 文档:https://github.com/scrapinghub/price-parser 安装 pip install price-parser 1 requires Python 3.6+. # -*- coding: utf-8 -*- from price_parser import parse_price price = parse_price(... 文档:https://github.com/scrapinghub/price-parser 安装 pip install price-parser 1 requires Python 3.6+. # -*- coding: utf-8 -*- from price_parser import parse_price price = parse_price(...
- 首先理解一下几个概念 笔记本 Python版本2.7 Python版本3.6 ... 首先理解一下几个概念 笔记本 Python版本2.7 Python版本3.6 ...
- Counter计数器,继承了dict类,基本可以和字典的操作一样 from collections import Counter # 实例化 counter = Counter("abcabcccaaabbb") print(counter) # Counter({'a': 5, 'b': 5, 'c': 4}) # 数量最多的2个 print(counter.m... Counter计数器,继承了dict类,基本可以和字典的操作一样 from collections import Counter # 实例化 counter = Counter("abcabcccaaabbb") print(counter) # Counter({'a': 5, 'b': 5, 'c': 4}) # 数量最多的2个 print(counter.m...
- 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) 根据第一轴返回乱序数组...
上滑加载中
推荐直播
-
码道新技能,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月份产品特性,通过“特性解读+实操演示+实战案例+设计创新”的组合,全方位展现码道在多会话并行与多智能体协作方面的能力,赋能开发者提升效率
正在直播
热门标签