Fork me on GitHub
摘要: 一、get请求 import requests,json def http_get(url,city): parmas = {"city":city} headers = {} proxies= {"http":"http://localhost:8080","https":"https://loc 阅读全文
posted @ 2022-06-23 15:26 sun8419082 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1.线程池异步调用使用方式 from concurrent.futures import ThreadPoolExecutor,wait import time,os #要添加的进程任务 def eat(some): print("I'm eating{}".format(some)) time.s 阅读全文
posted @ 2021-04-20 16:00 sun8419082 阅读(437) 评论(0) 推荐(0) 编辑
摘要: 1.导入 from enum import Enum 2.使用: from enum import Enum class Sun(Enum): username = 'suntao' age = 32 print(Sun.username.value) print(Sun.username.name 阅读全文
posted @ 2021-04-01 10:25 sun8419082 阅读(62) 评论(0) 推荐(0) 编辑
摘要: 1.安装 pip install pika #!/usr/bin/python # -*- coding: utf-8 -* """ 用于接收发送AMQP消息操作 """ import pika class AmqpConnect(): """AMQP消息收发""" def __init__(sel 阅读全文
posted @ 2021-03-31 18:12 sun8419082 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 1.安装 pip install paho-mqtt 2.使用 #!/usr/bin/python # -*- coding: utf-8 -* """ 接收mqtt消息 """ import paho.mqtt.client as mqtt import json,os import zlib i 阅读全文
posted @ 2021-03-31 18:08 sun8419082 阅读(759) 评论(0) 推荐(0) 编辑
摘要: 1.安装:pip install redis-py-cluster 2.使用: #!/usr/bin/env python # encoding: utf-8 from rediscluster import RedisCluster class RedisClient: """redis相关操作类 阅读全文
posted @ 2021-03-31 17:52 sun8419082 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 1.安装 pip install tqdm 2.使用: from tqdm import tqdm import time for i in tqdm(range(10000)): time.sleep(0.01) from tqdm import trange import time for i 阅读全文
posted @ 2021-03-31 17:46 sun8419082 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1.模块安装 pip install retrying 2.模块使用 from retrying import retry @retry(stop_max_attempt_number=3) def test1(): print("开始重试") raise NameError test1() 运行结 阅读全文
posted @ 2021-03-31 17:42 sun8419082 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1.xlrd常用方法 data = xlrd.open_workbook(file_name) #表格文件打开 table = data.sheets()[sheet_index] #sheet文档打开 name_data = table.col_values(name_index)#列数据获取,返 阅读全文
posted @ 2020-12-29 16:08 sun8419082 阅读(113) 评论(0) 推荐(0) 编辑
摘要: import yagmail #链接邮箱服务器yag = yagmail.SMTP( user="397238915@qq.com", password="bmcbqzclkjzobjjd", host='smtp.qq.com') # 邮箱正文contents = ['ni nong shuo z 阅读全文
posted @ 2020-06-22 15:30 sun8419082 阅读(542) 评论(0) 推荐(0) 编辑