![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python库
月尽天明_
请多指教!
展开
-
socket笔记
创建服务器from socket import *from time import ctime# 设置HOST,PORTHOST = ""PORT = 20000# 设置缓冲区大小BUFSIZE = 1024ADDR = (HOST, PORT)# 创建服务端sockettcpServerSock = socket(AF_INET, SOCK_STREAM)# 绑定到ADDR上t原创 2017-08-30 23:13:58 · 212 阅读 · 0 评论 -
fake_useragent 实例化对象时报错
import fake_useragent# 实例化对象时报错ua = fake_useragent.UserAgent()socket.timeout: timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last): ...原创 2018-12-11 11:16:53 · 4387 阅读 · 11 评论 -
centos7 yum安装MongoDB
1、配置yum源vim /etc/yum.repos.d/mongodb-org-3.4.repo2、输入一下内容,保存退出[mongodb-org-3.4]name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/gpgcheck...原创 2018-07-30 20:16:56 · 160 阅读 · 0 评论 -
python 查看、修改文件属性
In [132]:import os# 查看文件属性In [133]: os.stat('package-lock.json')Out[133]: os.stat_result(st_mode=33206, st_ino=7036874417947173, st_dev=651824810, st_nlink=1, st_uid=0, st_gid=0, st_size=304, st_a...原创 2018-07-30 00:05:21 · 12582 阅读 · 0 评论 -
python 时间库小结(time & datetime)
导入库import timeimport datetimetime1、使用time,获取当前时间的时间戳In [42]: time.time()Out[42]: 1532874802.02357582、将时间戳转为当前时区的时间元组 struct_timeIn [43]: time.localtime(time.time())Out[43]: time.s...原创 2018-07-29 23:38:47 · 590 阅读 · 0 评论 -
Python urlencode&urldecode
from urllib import parsetext = '123abc!@#静夜思'# quote与unquote对应编码、解码quote_text = parse.quote(text)print(quote_text)print(parse.unquote(quote_text))data = dict( a = 123, b = 'a...原创 2018-07-06 15:52:09 · 1246 阅读 · 0 评论 -
celery学习记录
启动redis服务# 保存为start_redis.batredis-server.exe redis.windows.conf不废话直接上代码#tasks.pyfrom celery import CeleryBROKERS = 'redis://localhost:6379/0'BACKEND = 'redis://localhost:6379/1'app = Celery('tasks'原创 2017-08-09 13:59:48 · 277 阅读 · 0 评论 -
python 批量升级所有库
import pipfrom subprocess import callfor i in pip.get_installed_distribuitions(): call("pip install -upgrade " + i.project_name, shell=True)如果安装了Anaconda,安装方式如下:# 更新所有第三方库conda update -all# 更新An原创 2017-08-30 23:40:20 · 5924 阅读 · 2 评论 -
pyautogui
一、准备文档地址:官方文档 介绍:The purpose of PyAutoGUI is to provide a cross-platform Python module for GUI automation for human beings. The API is designed to be as simple as possible with sensible defaults.原创 2017-08-17 11:02:42 · 2178 阅读 · 0 评论 -
Python 区间库 interval
示例1:创建区间&检验左右边界值In [22]: from interval import Interval# 创建实例In [23]: a = Interval(2,5)# 左右边界是均包含在内,为全闭区间In [24]: 2 in aOut[24]: TrueIn [25]: 5 in aOut[25]: True示例2:半闭半开区间&检测闭区间边界...原创 2019-07-31 17:18:12 · 4075 阅读 · 3 评论