自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

乱写乱画

写写画画

  • 博客(142)
  • 收藏
  • 关注

原创 zip方法用于将两个列表中的元素一一对应,生成一个新的元组列表

zip方法用于将两个列表中的元素一一对应,生成一个新的元组列表。

2023-05-30 11:26:04 178

原创 langid 代码对应的语种名

langid 代码对应的语种名

2023-02-20 16:01:30 445

原创 pymysql sql语句中引号问题

【代码】pymysql sql语句中引号问题。

2022-09-28 11:42:33 235

原创 python mysql where 当多条件查询时,动态出现某些查询条件为空的SQL写法

python mysql where 当多条件查询时,动态出现某些查询条件为空的SQL写法

2022-09-02 11:04:40 1126

原创 /backend_agg.py:238: RuntimeWarning: Glyph 26085 missing from current font.

linux 使用python matplotlib画图时没有字体显示中文,导致中文乱码 删除matplotlib字体缓存 rm -rf /home/ubuntu/.cache/matplotlib 然后在python中指定字体,即可正常显示中文

2022-06-09 15:05:07 752 1

原创 Python3通过writerow写入csv文件 多了一条空行

1.声明csv.writer() 时 将dialect设置为unix,换行符即为'\n'with open(self.game_name + '2022.csv', 'w', encoding='utf-8-sig') as f: writer = csv.writer(f, dialect='unix') # 将dialect设置为unix,换行符即为'\n' writer.writerow(self.bilibili_columns)

2022-05-31 15:59:49 1044

原创 django项目迁移安装包名与报错不一致

pip3 install django-sslserver

2022-05-23 17:16:33 403

原创 修改MySQL密码策略

更新密码报错:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements由于一直用一个密码,所以不想换,选择修改密码策略查看MySQL密码策略+--------------------------------------+--------+| Variable_name | Value |+------------------------

2022-05-18 14:44:35 500

原创 mysql 代替 row_number

set @rank:=0;select "huya" as PT, T1.game_name, T1.profileRoom, T2.totalCount, T3.DM from ( select count(DISTINCT profileRoom) as profileRoom,game_name from huyaLiveInfo where date_format(insert_date, '%Y-%m-%d') = "2022-01-24" group by game_name) T1..

2022-02-14 15:18:51 556

原创 常用正则收录

常用正则

2021-12-02 11:50:13 72

原创 pymysql 重连

self.conn.ping(reconnect=True)

2021-11-01 10:23:29 604

原创 MySQL day关联day-1实现数据日级变化

select upload_time, game_name, TDVX, YDVX, TDBD, YDBD, CASE WHEN (TDVX-YDVX)/TDVX IS NULL THEN 0 else CONCAT(CONVERT(round((TDVX-YDVX)/TDVX*100, 2), CHAR), "%") end "VX%", CASE WHEN (TDBD-YDBD)/TDBD IS NULL THEN 0 e.

2021-09-29 11:15:33 257

原创 MySQL 数值拼接字符串

CONCAT(CONVERT(round((TDComment-YDComment)/TDComment*100, 2), CHAR), "%")数值转字符串 CONVERT(数值, CHAR)字符串拼接CONCAT("Value1", "Value2")

2021-09-29 11:02:15 459

原创 mysql日期加减

DATE_FORMAT(DATE_ADD(b.upload_time_lastday, INTERVAL 1 DAY), '%Y-%m-%d')DATE_FORMAT(DATE_ADD(b.upload_time_lastday, INTERVAL 1 month), '%Y-%m-%d')DATE_FORMAT(DATE_ADD(b.upload_time_lastday, INTERVAL 1 year), '%Y-%m-%d')DATE_FORMAT(DATE_SUB(b.upload_t

2021-09-09 09:58:16 63

原创 mysql 保留小数位数

round(x,d)x 需要被精确的数值d 保留小数位数

2021-08-27 15:11:59 318

转载 windows下python使用protobuf的开门级教程

转载自:https://blog.csdn.net/u013992365/article/details/81287041一、在windows下编译python所需的protobuf的相关文件1、首先下载protobuf源码(后一个是我自己从github上down的,因为版本是3.6.0,因为网不好下了很久,但是这个是完全体,就是我把包括python在内的全部版本都下了下来):https://github.com/google/protobuf/releases/tag/v3.6.0或是:http

2021-07-23 16:07:43 874 2

原创 is not clickable at point (530, 16). Other element would receive the click

使用selenium发送点击请求报错翻译了一下不能点击,被其他元素接受了请求解决方法1button.send_keys("\n") #方法2from selenium.webdriver.common.keys import Keysbutton.send_keys(Keys.SPACE) #方法3driver.execute_script("arguments[0].click();", button)经过gen...

2021-06-15 17:07:33 168

原创 ValueError: check_hostname requires server_hostname

python3 爬取数据时报错requests.get("https://www.baidu.com/", proxies={'http': 'http://183.53.29.159:25862', 'https': 'https://183.53.29.159:25862'})

2021-06-10 15:46:28 134

原创 TypeError: __init__() takes 1 positional argument but 5 positional arguments (and 1 keyword-only arg

python脚本迁移时报错:TypeError: __init__() takes 1 positional argument but 5 positional arguments (and 1 keyword-only argument) were given原因:

2021-06-08 15:34:48 1006 1

原创 python 保留小数位数

a = 12.345a1 = round(a, 2)print(a1)

2021-04-22 11:05:20 144

原创 selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

http://npm.taobao.org/mirrors/chromedriver/89.0.4389.23/1,到这个地址下载浏览器对应的浏览器驱动2,将安装包解压代码指定驱动路径webdriver.Chrome(r'E:\ChromeDriver\chromedriver.exe', chrome_options=chrome_options)

2021-04-19 10:12:09 345

原创 selenium 自动下载对应Chrome版本

from webdriver_manager.chrome import ChromeDriverManagerbrowser = webdriver.Chrome(ChromeDriverManager().install())

2021-04-16 16:24:34 235

原创 python sorted 处理二维数组排序

>>> l = [[1, 2, 3], [2, 3, 4], [2, 1, 3]]>>> sorted(l, key=lambda l: l[1], reverse=True)[[2, 3, 4], [1, 2, 3], [2, 1, 3]]>>> sorted(l, key=lambda l: l[1])[[2, 1, 3], [1, 2, 3], [2, 3, 4]]

2021-03-17 14:42:15 2985

原创 Ubuntu 安装MySQL 并设置其他主机可访问

json 方法:json.dumps 将 Python 对象编码成 JSON 字符串 json.loads 将已编码的 JSON 字符串解码为 Python 对象 import jsonwith open(r'D:\python\not\mysql\file_name.json', 'a+') as f: json.dump(valid_proxies,...

2021-02-23 15:37:43 469

转载 pip install 安装第三方库报错SSL: CERTIFICATE_VERIFY_FAILED

bootstrap下载地址:https://v3.bootcss.com/getting-started/#download创建Django项目:django-admin startproject 项目名新建一个文件夹存储所有的APP mkdir APPS

2020-12-30 18:16:56 339

原创 微信小程序 onLoad函数中页面跳转 not found page

原因:小程序启动时,所有页面未加载完成,所以未能找到页面解决:加个定时器 setTimeout(function () { wx.navigateTo({ url: '/pages/home/home', }) }, 500)

2020-09-30 10:43:37 761 1

原创 python jsonpath与get 尝试获取json字符串中指定key

jsonpath:语法类似xpath,尝试指定范围获取所有符合条件的key,返回类型:listvalue 为json objimport jsonimport jsonpathjsonpath.jsonpath(value, "$..numComments")get 字典方法,尝试获取key,没有返回指定内容,默认为空>>> text = {"c":1, "a":1}>>> richtext2 = text.get('t', "")>&g.

2020-09-10 16:25:19 2155 1

原创 pandas数据处理--将txt中的数据进行去重统计数量

import pandas as pdimport numpy as npfrom openpyxl import load_workbookimport osimport reclass doWork: def __init__(self): self.txt_file_dir = "txt_file" self.excel_name1 = r"template.xlsx" # 模板文件 self.excel_name2 = r"sta.

2020-08-10 19:07:44 1170

原创 pandas 写入不同sheel

writer=pd.ExcelWriter('tarkov_market.xlsx') self.last_1_Y.to_excel(writer,sheet_name='last_1_M',index=0)#index=0:无索引 self.last_6_M.to_excel(writer,sheet_name='last_7_day',index=0) self.last_1_M.to_excel(writer,sheet_name='last_1_Y'.

2020-08-10 11:04:54 165

原创 Python 递归当前文件夹下的所有文件

def get_dir(code_file_dir): #获取目录路径 for root,dirs,files in os.walk(code_file_dir, followlinks=False): #遍历path,进入每个目录都调用visit函数,,有3个参数,root表示目录路径,dirs表示当前目录的目录名,files代表当前目录的文件名 print(root,dirs,files) for filename in files: f.

2020-08-10 10:25:48 271

原创 Python 报错重试 装饰器

def retry_on_failure(func): def wrapper(*args, **kwargs): flage = 0 while True: if flage >= 2: raise Exception('超过重试次数boom') try: return func(*args, **kwargs) excep.

2020-07-30 19:54:42 315

原创 Python 爬虫处理base64加密,解密方法

import base64import timectime = str(time.time())user_str = str({'user':user, 'user_type':user_type, 'user_id':user_id})# 加密token = base64.b64encode(user_str.encode(encoding='utf-8')).decode()# 解密user_str = base64.b64decode(token.encode(encoding='u.

2020-07-28 09:47:58 1212 1

原创 pandas 将两数据表进行拼接

将两文本内容以下图为例合并,空值补0:import pandas as pddef go(path1, path2, new_file_name): df1 = pd.read_csv(path1, encoding="utf-8") df2 = pd.read_csv(path2, encoding="utf-8") columns = df1.columns df_obj = pd.concat([df1,df2], sort=False) ..

2020-07-24 15:55:33 513

转载 微博 帖子转发下 json字段描述

{ "created_at": "Tue May 31 17:46:55 +0800 2011", # 创建时间 "id": 11488058246, # 微博id "text": "求关注。", # 微博信息内容 "source": "<a href="http://weibo.com" rel="nofollow">新浪微博</a>", # 微博来源 "favorited": false, # 是否已收藏 "truncated":.

2020-07-24 15:41:58 570

原创 Python 队列生产者,消费者模型

In [1]: from queue import Queue ...: ...: import random ...: ...: import threading ...: ...: import timeIn [3]: class Producer(threading.Thread): ...: def __init__(self, t_name, queue): ...: threading.Thread.__init__(.

2020-07-17 10:41:23 142

原创 Python No module named ‘sklearn.cross_validation‘

sklearn中已经废弃cross_validation,将其中的内容整合到model_selection中 将sklearn.cross_validation 替换为 sklearn.model_selection

2020-07-14 16:53:04 129

原创 python字典自定义排序,使用匿名函数根据字典value大小排序

d= {'a':24,'g':52,'i':12,'k':33}sorted(d.items(), key=lambda x : x[1], reverse=True)# d.items() 字典items将字典变为(key,value)的元组对象# key 自定义排序规则# reverse 是否倒序

2020-07-07 16:07:29 589

原创 python 数据写入json文件时中文显示Unicode编码问题

使用:json加载时数据出现Unicodereturn json.dumps(content)输出:{"Harris HBR Bipod": {"description": "Harris HBR ultralight foldable bipod with spring retraction mechanism. Used across the world by service operators and civilian shooters worldwide.\n", "General

2020-06-29 16:09:21 3764

原创 MySQL 字符转小数

convert(`avg_reply_num`, decimal(18,2))

2020-06-08 16:41:59 491

原创 MySQL 替代rownum的方法

select H.a_cut_word, H.a_word_frequency, H.a_avg_reply_num,@rownum:=@rownum+1 rownum, -- 自增行号if(@pdept:=H.a_cut_word, @rank:=@rank+1, @rank:=1) as rank, --如果变量不为分组值,则分组行号+1,反之则为1@pdept:=H.a_cut_wordfrom(select cut_word as a_cut_word, avg(word_.

2020-06-03 11:21:09 1916

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除