随笔分类 -  python

摘要:import time import csv from playwright.sync_api import Playwright, sync_playwright with sync_playwright() as playwright: browser = playwright.chromium 阅读全文
posted @ 2024-04-01 18:16 hziwei 阅读(26) 评论(0) 推荐(0) 编辑
摘要:from typing import Tuple import pyperclip import pyautogui import cv2 import numpy as np class Gui(object): ''' pyautogui 操作 ''' @classmethod def find 阅读全文
posted @ 2024-04-01 18:15 hziwei 阅读(28) 评论(0) 推荐(0) 编辑
摘要:C代码 文件名 《task.c》 # include<stdio.h> int task(int n, int p, int m){ int i,j,k; unsigned long s = 0; for(i=0;i<n;i++){ for(j=0;j<p;j++){ for(k=0;k<m;k++ 阅读全文
posted @ 2023-05-04 17:32 hziwei 阅读(40) 评论(0) 推荐(0) 编辑
摘要:一、代码 import os import random import logging import sentry_sdk from sentry_sdk.tracing import Transaction from sentry_sdk.integrations.logging import L 阅读全文
posted @ 2022-12-07 14:23 hziwei 阅读(193) 评论(0) 推荐(0) 编辑
摘要:一、步骤 1、镜像基础 2、复制代码 3、设置工作目录 4、把需要执行的shell命令编写成脚本文件 5、配置容器启动自动执行脚本,CMD在docker run时运行脚本 DockerFile 脚本 # 基于镜像基础 FROM python:3.7.9 # 复制⽂件到容器中 COPY ./src / 阅读全文
posted @ 2022-09-06 10:54 hziwei 阅读(831) 评论(0) 推荐(0) 编辑
摘要:一、查看GPU驱动 nvidia-smi 二、查看cuda版本 nvcc -V 三、根据cuda版本确定去官网查看torch版本,运行查询出来的代码 查看torch版本 pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchau 阅读全文
posted @ 2021-06-27 10:24 hziwei 阅读(634) 评论(0) 推荐(1) 编辑
摘要:一、配置文件 # 定义logger模块,root是父类,必需存在的,其它的是自定义。 # logging.getLogger(NAME)便相当于向logging模块注册了一种日志打印 # name 中用 . 表示 log 的继承关系 [loggers] keys=root,simpleExample 阅读全文
posted @ 2021-06-10 11:37 hziwei 阅读(2386) 评论(0) 推荐(0) 编辑
摘要:1、service.py import os,sys # 创建子进程 pid = os.fork() if pid > 0: sys.exit(0) pass # 修改子进程工作目录 os.chdir("/") # 创建新的会话,子进程成为会话的首进程 os.setsid() # 修改工作目录的um 阅读全文
posted @ 2021-03-04 18:16 hziwei 阅读(138) 评论(0) 推荐(0) 编辑
摘要:一、下载依赖包 pip install paho-mqtt 二、创建监听订阅和发布 监听程序,订阅和发布,可以根据订阅的信息进行处理 import paho.mqtt.client as mqtt import json import time host = '127.0.0.1' # mqtt服务 阅读全文
posted @ 2021-02-08 17:34 hziwei 阅读(1147) 评论(0) 推荐(0) 编辑
摘要:一、下载cx_Oracle pip install cx_Oracle 二、创建连接 # 第一种创建方式 conn = cx_Oracle.connect(f"{user}/{password}@{host}:{port}/{service}") # 第二种创建方式 conn = cx_Oracle 阅读全文
posted @ 2020-10-16 10:10 hziwei 阅读(320) 评论(0) 推荐(0) 编辑
摘要:依赖库 pandas sqlalchemy pymysql 读取数据库 from sqlalchemy import create_engine import pandas as pd # 创建数据库连接对象 win_user = 'root' # 数据库用户名 win_password = '12 阅读全文
posted @ 2020-10-09 14:50 hziwei 阅读(5598) 评论(0) 推荐(0) 编辑
摘要:code:https://github.com/hziwei/TensorFlow-/blob/master/python%20gensim%E4%BD%BF%E7%94%A8word2vec.ipynb 下载gensim库 pip install gensim -i https://pypi.do 阅读全文
posted @ 2020-08-25 14:21 hziwei 阅读(6301) 评论(0) 推荐(0) 编辑
摘要:导入依赖包 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt 使用numpy随机生成训练数据 通过随机生成的x求出对应的y值,可以自己指定求出y值的方法,主要是使x和y有对应的关系 # 使用mumpy 阅读全文
posted @ 2020-08-20 18:26 hziwei 阅读(206) 评论(0) 推荐(0) 编辑
摘要:在工作中,可能会遇到这种编码 s = '4&#12289;&#36225;&#30528;&#24180;&#36731;&#65292;&#26377;&#31934;&#21147;&#65292;&#33021;&#21435;&#22810;&#36828;&#36208;&#22810;& 阅读全文
posted @ 2020-08-12 17:56 hziwei 阅读(512) 评论(0) 推荐(0) 编辑
摘要:Hbase连接使用 安装happybase和thrift pip install happybase pip install thrift import happybase # 1.从数据库导入到hbase if __name__ != '__main__': import pandas as pd 阅读全文
posted @ 2020-07-23 18:10 hziwei 阅读(126) 评论(0) 推荐(0) 编辑
摘要:使用pyspark连接数据库 # spark操作数据库 from pyspark.sql import SQLContext, SparkSession from pyspark import SparkConf, SparkContext # spark地址 master_url = "spark 阅读全文
posted @ 2020-07-23 18:09 hziwei 阅读(326) 评论(0) 推荐(0) 编辑
摘要:Scrapy 和 scrapy-redis的区别 scrapy是一个Python爬虫框架,爬取效率极高,具有高度定制性,但是不支持分布式。而scrapy-redis一套基于redis数据库、运行在scrapy框架之上的组件,可以让scrapy支持分布式策略,Slaver端共享Master端redis 阅读全文
posted @ 2020-07-23 18:07 hziwei 阅读(228) 评论(0) 推荐(0) 编辑

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