随笔分类 -  python

摘要:python安装运行requests报错: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently " f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION}. " "See: https: 阅读全文
posted @ 2024-04-10 09:42 明天OoO你好 阅读(430) 评论(0) 推荐(0) 编辑
摘要:[root@localhost apps]# cat /etc/supervisor/conf.d/command_analyzer_celery_* [program:book]command=/home/project/bookmanager/venv/bin/gunicorn -w 8 -b 阅读全文
posted @ 2021-01-11 20:20 明天OoO你好 阅读(353) 评论(0) 推荐(0) 编辑
摘要:count = 0 with open('/cm/com.file','rb') as f: while True: buffer = f.read(1024*8192) if not buffer: break count += buffer.count(b"\n") print(count) 阅读全文
posted @ 2020-11-30 22:29 明天OoO你好 阅读(1136) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*- BADREQUEST = 400 UNAUTHORIZED = 401 FORBIDDEN = 403 GONE = 410 TOOMANYREQUESTS = 412 class DnsdbException(Exception): def __in 阅读全文
posted @ 2020-11-15 14:20 明天OoO你好 阅读(357) 评论(0) 推荐(0) 编辑
摘要:import configparser import logging from logging.handlers import RotatingFileHandler config = configparser.ConfigParser() config.read("config", encodin 阅读全文
posted @ 2020-11-07 11:41 明天OoO你好 阅读(180) 评论(0) 推荐(0) 编辑
摘要:word_cloud = []cc = [{"c58":341,"c59":525,"c56":507,"c57":341,"c54":639,"c55":499,"c23":542,"c63":751,"c64":815,"c17":306,"c16":360,"c19":593,"c18":33 阅读全文
posted @ 2018-03-23 10:26 明天OoO你好 阅读(629) 评论(0) 推荐(0) 编辑
摘要:所有日期、时间的api都在datetime模块内。 1. 日期输出格式化 datetime => string import datetime now = datetime.datetime.now() now.strftime('%Y-%m-%d %H:%M:%S') 输出 '2015-04-07 阅读全文
posted @ 2018-02-08 15:20 明天OoO你好 阅读(317) 评论(0) 推荐(0) 编辑
摘要:# -*- coding:UTF-8 -*- import json from collections import OrderedDict with open('dns_status.json','r') as f: data = json.load(f) import pandas as pd from datetime import datetime def datelist(... 阅读全文
posted @ 2017-11-01 15:28 明天OoO你好 阅读(11504) 评论(0) 推荐(0) 编辑
摘要:import pandas as pd from datetime import datetime def datelist(beginDate, endDate): # beginDate, endDate是形如‘20160601’的字符串或datetime格式 date_l=[datetime.strftime(x,'%Y-%m') for x in list(pd.date... 阅读全文
posted @ 2017-11-01 13:58 明天OoO你好 阅读(338) 评论(0) 推荐(0) 编辑
摘要:mailto = ['cc', 'bbbb', 'afa', 'sss', 'bbbb', 'cc', 'shafa'] addr_to = list(set(mailto)) addr_to.sort(key = mailto.index) 阅读全文
posted @ 2017-11-01 13:36 明天OoO你好 阅读(3489) 评论(2) 推荐(0) 编辑
摘要:from collections import defaultdict import json def tree(): return defaultdict(tree) categories = tree() a = categories['Programming Languages']['Python'] b = categories['Programming Languag... 阅读全文
posted @ 2017-08-17 18:18 明天OoO你好 阅读(819) 评论(0) 推荐(0) 编辑
摘要:import winrm win2012 = winrm.Session('http://192.168.0.19:5985/wsman',auth=('wt','635870838')) r = win2012.run_cmd('D: &' ' cd python &' ' type s.txt &' ... 阅读全文
posted @ 2017-04-24 16:07 明天OoO你好 阅读(12965) 评论(1) 推荐(0) 编辑
摘要:ips = ['', '123.125.71.49', '164.132.161.48', '217.182.132.55', '217.182.132.55', '217.182.132.94', '220.181.108.162', '51.255.65.47', '51.255.65.6', '51.255.65.77', '51.255.65.96'] r = Co... 阅读全文
posted @ 2017-04-21 11:14 明天OoO你好 阅读(265) 评论(0) 推荐(0) 编辑
摘要:# !/usr/bin/env python # -*- coding:utf-8 -*- import queue import threading import time class WorkManager(object): def __init__(self, work_num=1000,thread_num=10): # work_num是总的任务数,thread_num... 阅读全文
posted @ 2017-03-25 16:53 明天OoO你好 阅读(554) 评论(0) 推荐(0) 编辑
摘要:1.常见的时间复杂度(按耗费的时间排序,时间耗费越少效率越高) O(1)<O(logn)<O(n)<O(nlogn)<O(n2)<O(n2logn)<O(n3) 循环减半就是(O(logn)) 2.冒泡排序 3.冒泡排序优化 4.快速排序 阅读全文
posted @ 2017-03-10 13:19 明天OoO你好 阅读(218) 评论(0) 推荐(0) 编辑
摘要:1.将字符串的时间转换为时间戳方法:a = "2013-10-10 23:40:00"将其转换为时间数组import timetimeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S")转换为时间戳:timeStamp = int(time.mktime(tim 阅读全文
posted @ 2017-03-07 15:04 明天OoO你好 阅读(352) 评论(0) 推荐(0) 编辑
摘要:官方文档有句话"allows you to call any program",并且: helps you write shell scripts in Python by giving you the good features of Bash 第一句话助你在Python中轻松调用自己的程序,第二 阅读全文
posted @ 2017-02-19 22:05 明天OoO你好 阅读(4081) 评论(0) 推荐(0) 编辑
摘要:Python中操作mysql的pymysql模块详解 Python中操作mysql的pymysql模块详解 前言 pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb几乎相同。但目前pymysql支持python3.x而后者不支持3.x版本。 本文测试python版本:2.7 阅读全文
posted @ 2016-12-07 15:04 明天OoO你好 阅读(99716) 评论(11) 推荐(23) 编辑
摘要:python 使用pymssql连接sql server数据库 #coding=utf-8 #!/usr/bin/env python# # Name: pymssqlTest.py# Purpose: 测试 pymssql库,该库到这里下载:http://www.lfd.uci.edu/~gohl 阅读全文
posted @ 2016-12-07 14:52 明天OoO你好 阅读(2175) 评论(0) 推荐(0) 编辑
摘要:发布/订阅 系统 1.基本用法 生产者 消费者 2. 实现功能:(1)rabbitmq循环调度,将消息循环发送给不同的消费者,如:消息1,3,5发送给消费者1;消息2,4,6发送给消费者2。 (2)消息确认机制,为了确保一个消息不会丢失,RabbitMQ支持消息的确认 , 一个 ack(acknow 阅读全文
posted @ 2016-10-17 16:37 明天OoO你好 阅读(20264) 评论(2) 推荐(1) 编辑

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