随笔分类 - Python
摘要:一、第一次使用conda环境 二、添加conda虚拟环境
阅读全文
摘要:一、% 1 # %d %f %s 2 # %nd n为位置的数量, n>0 正数居右,n<0 正数居左 3 # %f 默认保留小数点后6位,%.nf,n为保留小数点后几位 4 print("%s有%2d个老婆,每个老婆要给%f两" % ("西门庆", 6, 9.9)) 5 print("%s有%-2
阅读全文
摘要:import requests _url = "http://127.0.0.1:8000/test2/" files = { "image": ("e.jpg", open(r"C:\Users\wuhao\Desktop\e.jpg", 'rb'), "image/jpeg"), } data
阅读全文
摘要:1、java端 package com.bd; import py4j.GatewayServer; import com.arcsoft.face.FaceFeature; public class FaceMain { public Double getFeature(String path1,
阅读全文
摘要:import uuid def get_mac_address(): node = uuid.getnode() mac = uuid.UUID(int=node).hex[-12:] print(mac) return mac get_mac_address()
阅读全文
摘要:根据phone 查找 地点 安装 pip install phone 引用 from phone import Phone 使用 # 通过 电话号码 获取省份 通过 Phone模块 def get_province_city(self, phone_num): try: info = Phone()
阅读全文
摘要:清华 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 豆瓣 推荐 pip config set global.index-url https://pypi.douban.com/simple
阅读全文
摘要:递归 def df_merge(self, df_lst): df_len = len(df_lst) if df_len == 1: return df_lst[0] elif df_len == 2: return df_lst[0].merge(df_lst[1], on=["company"
阅读全文
摘要:file_name = "code.png" file_path = os.path.join(pics_path, file_name) self.driver.find_element_by_tag_name('img').screenshot(file_path) 切换窗口 driver.ex
阅读全文
摘要:1、参考文章 http://liyangliang.me/posts/2015/06/using-supervisor/ 按照这个参考完全够用 2、官网 http://supervisord.org/ 3、补充 运行挂起 nohup python解释器的决对路径 运行的决定路径 &
阅读全文
摘要:保护用户隐私或打码 def mark_star(name: str, ratio=0.6): l = len(name) star_len = int(l * ratio) remain_len = l - star_len print(remain_len) if remain_len % 2 =
阅读全文
摘要:测试,尚未开发完成 from __future__ import unicode_literals from threading import Timer from wxpy import * import requests from lxml import etree # 登录微信 bot = B
阅读全文
摘要:1、setting.py 注意:创建log文件夹 # 存放Log的目录 LOGGING_DIR = os.path.join(BASE_DIR, 'log') LOGGING = { 'version': 1, 'disable_existing_loggers': True, 'formatter
阅读全文
摘要:1、开启baidu-api的文字识别 2、查看官方文档 3、例子 import time import pymysql import requests from aip import AipOcr from config import dev_db from config import APP_ID
阅读全文
摘要:1、安装 pip install opencv_python 2、具体代码(借鉴) import cv2 import numpy as np # 均值哈希算法 def aHash(img): # 缩放为8*8 img = cv2.resize(img, (8, 8), interpolation=
阅读全文
摘要:1、镜像 https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-windows-x86_64.zip 2、安装(参考) http://www.pianshen.com/article/1577447535
阅读全文
摘要:例子 url = 'http://beanhome.com/user/login' header = { "Content-Type": 'application/json', "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5
阅读全文
摘要:高级的 文件、文件夹、压缩包 处理模块 shutil.copyfileobj(fsrc, fdst[, length])将文件内容拷贝到另一个文件中 import shutil shutil.copyfileobj(open('old.xml','r'), open('new.xml', 'w'))
阅读全文
摘要:线程池的两张方法 submit 和map from concurrent.futures import ThreadPoolExecutor import time # def sayhello(a): time.sleep(2) return "hello: "+a def main(): see
阅读全文