摘要:
一、get请求 import requests,json def http_get(url,city): parmas = {"city":city} headers = {} proxies= {"http":"http://localhost:8080","https":"https://loc 阅读全文
摘要:
1.线程池异步调用使用方式 from concurrent.futures import ThreadPoolExecutor,wait import time,os #要添加的进程任务 def eat(some): print("I'm eating{}".format(some)) time.s 阅读全文
摘要:
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 阅读全文
摘要:
1.安装 pip install pika #!/usr/bin/python # -*- coding: utf-8 -* """ 用于接收发送AMQP消息操作 """ import pika class AmqpConnect(): """AMQP消息收发""" def __init__(sel 阅读全文
摘要:
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 阅读全文
摘要:
1.安装:pip install redis-py-cluster 2.使用: #!/usr/bin/env python # encoding: utf-8 from rediscluster import RedisCluster class RedisClient: """redis相关操作类 阅读全文
摘要:
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 阅读全文
摘要:
1.模块安装 pip install retrying 2.模块使用 from retrying import retry @retry(stop_max_attempt_number=3) def test1(): print("开始重试") raise NameError test1() 运行结 阅读全文
摘要:
1.xlrd常用方法 data = xlrd.open_workbook(file_name) #表格文件打开 table = data.sheets()[sheet_index] #sheet文档打开 name_data = table.col_values(name_index)#列数据获取,返 阅读全文
摘要:
import yagmail #链接邮箱服务器yag = yagmail.SMTP( user="397238915@qq.com", password="bmcbqzclkjzobjjd", host='smtp.qq.com') # 邮箱正文contents = ['ni nong shuo z 阅读全文