随笔分类 -  python

摘要:完美解决 ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl. 1.问题描述 大家用python操作excel,会遇到 ImportError: Missing optio 阅读全文
posted @ 2022-07-10 12:01 xiongsheng 阅读(41863) 评论(1) 推荐(1) 编辑
摘要:1. 引入第三方库 from Bio import SeqIO import matplotlib.pyplot as plt 2. 写函数 def sequence(file_name): info_dict = {} # 绘图数据 # 检查后缀 raw = open(file_name, err 阅读全文
posted @ 2022-05-23 12:40 xiongsheng 阅读(336) 评论(0) 推荐(0) 编辑
摘要:1.查看所有的关键字 help("keywords") 2. 查看python所有的modules help("modules") 3. 单看python所有的modules中包含指定字符串的modules help("modules yourstr") 4. 查看python中常见的topics 阅读全文
posted @ 2022-04-03 00:19 xiongsheng 阅读(240) 评论(0) 推荐(0) 编辑
摘要:基于Python的Modbus协议获取寄存器数据 1. Modbus通讯协议 Modbus是一种串行通信协议,是Modicon公司(现在的施耐德电气 Schneider Electric)于1979年为使用可编程逻辑控制器(PLC)通信而发表。Modbus已经成为工业领域通信协议的业界标准(De f 阅读全文
posted @ 2022-03-28 21:58 xiongsheng 阅读(3293) 评论(2) 推荐(0) 编辑
摘要:GIL锁 GIL 全局解释器(Global Interpreter lock), 是cpython 解释器特有的,让一个进程中同一个时刻只能有一个线程可以被CPU调用。 如果程序想利用计算机的多核优势,让cpu同时处理一些任务,适合用多进程开发(即使资源开销大)。 如果程序不利用计算机的多核优势,适 阅读全文
posted @ 2022-03-26 16:13 xiongsheng 阅读(52) 评论(0) 推荐(0) 编辑
摘要:python3 中的内置函数 内置函数就是python给提供的,拿来直接用的函数,例如print ,input 等。 截至到python版本3.6.2 ,python 一共提供了68个内置函数,具体如下 本文将这68个内置函数综合整理分为12 大类,正在学习python基础的小伙伴大家一定不要错过, 阅读全文
posted @ 2022-03-26 16:09 xiongsheng 阅读(401) 评论(0) 推荐(0) 编辑
摘要:Django视图层--FBV与CBV FBV与CBV 视图是可以用来调用的,用来处理请求(request)并返回响应(response), Django的视图有两种形式 : FBV与CBV FBV 是基于函数的视图 (function base views) CBV 是基于类的视图(class ba 阅读全文
posted @ 2022-03-03 19:39 xiongsheng 阅读(138) 评论(0) 推荐(0) 编辑
摘要:Django ORM 连接超时的坑 数据库链接丢失异常 django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query') 查询mysql全局变量SHOW GLOBAL VARIABLES; 阅读全文
posted @ 2022-02-11 08:57 xiongsheng 阅读(504) 评论(0) 推荐(0) 编辑
摘要:# 赋值 a = 1 b = a print(a, b) print(id(a), id(b)) # id是相同的 c = [1, 2, 3] d = c c[0] = "xiongsheng" print(c, d) # 浅拷贝 import copy li1 = [1, 2, 3] li2 = 阅读全文
posted @ 2022-02-11 00:33 xiongsheng 阅读(45) 评论(0) 推荐(0) 编辑
摘要:小白一看都能懂! 最新更新一个非常详细的博客,小白一看就能懂! → Python学习手册 猛击! 阅读全文
posted @ 2021-11-23 10:08 xiongsheng 阅读(30) 评论(0) 推荐(0) 编辑
摘要:import threading import time import inspect import ctypes def _async_raise(tid, exctype): """raises the exception, performs cleanup if needed""" tid = 阅读全文
posted @ 2021-08-31 16:20 xiongsheng 阅读(1446) 评论(0) 推荐(0) 编辑
摘要:Django数据库的迁移命令 当模型类写好之后我们通常要进行数据库的迁移才能在数据库中创建表 生成迁移文件 python manage.py makemigrations 同步到数据库中 python manage.py migrate 例如 (pythonvenv) C:\Users\Harry\ 阅读全文
posted @ 2021-06-29 19:12 xiongsheng 阅读(840) 评论(0) 推荐(0) 编辑
摘要:获取端口信息 from serial.tools import list_ports port_list = list(list_ports.comports()) num = len(port_list) ports = [] if num <= 0: print("找不到任何串口设备") els 阅读全文
posted @ 2021-06-29 16:40 xiongsheng 阅读(1481) 评论(0) 推荐(0) 编辑
摘要:1.python基础知识 1.0 计算机组成原理和python基础知识 一,计算机基础 1、计算机硬件组成 1.1 一个程序的运行与三大核心硬件(cpu、内存、硬盘)的关系 (*****) 2、操作系统 2.1 计算机体系的三层结构 (*****) 2.2 平台与跨平台的概念 (*****) 3、扫 阅读全文
posted @ 2021-06-03 11:54 xiongsheng 阅读(163) 评论(0) 推荐(0) 编辑
摘要:cmd 打开命令提示符 找到自己想创建的位置路径 输入 python -m venv 创建的名称 例如: Microsoft Windows [版本 10.0.19042.685] (c) 2020 Microsoft Corporation. 保留所有权利。 C:\Windows\system32 阅读全文
posted @ 2021-05-21 19:00 xiongsheng 阅读(502) 评论(0) 推荐(0) 编辑
摘要:一、国内镜像 清华 https://pypi.tuna.tsinghua.edu.cn/simple 豆瓣 pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com '模块版本' 阿里云 pip insta 阅读全文
posted @ 2021-05-08 17:28 xiongsheng 阅读(1517) 评论(0) 推荐(0) 编辑
摘要:第一步下载 官网下载地址 https://downloads.mysql.com/archives/community/ 第二步解压 解压 下载的zip文件解压,将解压之后的文件夹放到任意目录下,这个目录就是mysql的安装目录。 配置 打开目录,会看到my-default.ini配置文件,复制这个 阅读全文
posted @ 2021-05-08 16:17 xiongsheng 阅读(85) 评论(0) 推荐(0) 编辑
摘要:工作场景 使用pycharm下启动项目 报错提示 没有安装 aliyunsdkiotclient模块 本人电脑系统 window10 python3.8.6 使用常规方法在python中pip install 安装 输入命令 pip install aliyun-python-sdk-iot-cli 阅读全文
posted @ 2021-05-07 18:43 xiongsheng 阅读(424) 评论(0) 推荐(0) 编辑
摘要:import serial # 引入库 import threading # python 定时器 import platform # 系统 import modbus_tk.modbus_rtu as rtu import modbus_tk.defines as cst try: sys = p 阅读全文
posted @ 2021-05-06 14:10 xiongsheng 阅读(465) 评论(0) 推荐(0) 编辑
摘要:import os # 学生类 class Student(object): def __init__(self, name, age, sex): self.name = name self.age = age self.sex = sex # 定义学生管理系统类, 顶级函数和顶级类都要有两个换行 阅读全文
posted @ 2021-04-23 13:58 xiongsheng 阅读(109) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示