摘要: 接收消息 #!/usr/bin/env python # -*- coding:utf-8 -*- # Author: vita import pika # 建立与rabbitmq的连接 credentials = pika.PlainCredentials("mq","mq123") connec 阅读全文
posted @ 2021-05-25 17:51 Mr.zou 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 线程池 from concurrent.futures import ThreadPoolExecutor,as_completed import time #为什么要线程池 #主线程可以获取某一个线程的状态或者某一个任务的状态,以及返回值 #当一个线程完成的时候,主线程立马知道 #funtures 阅读全文
posted @ 2021-02-07 14:19 Mr.zou 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 多态和多态性 import abc #多态 #多态是指一类事物有多种形态,比如动物类,可以有猫,狗,猪等等。(一个抽象类有多个子类,因而多态的概念依赖于继承) class Animal(metaclass=abc.ABCMeta): #同一类事物:动物 @abc.abstractmethod def 阅读全文
posted @ 2021-02-05 11:40 Mr.zou 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 互斥锁 from threading import Thread,Lock import os,time #互斥锁 def work(): global n lock.acquire() # 锁住n,让他依次执行 temp = n print(n) time.sleep(0.1) n=temp-1 阅读全文
posted @ 2021-02-04 17:42 Mr.zou 阅读(272) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python #-*- coding: utf-8 -*- from time import ctime, sleep import threading import time loops = ['江西', '吉安'] class MyThread(threading. 阅读全文
posted @ 2021-02-03 16:43 Mr.zou 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 发送邮件脚本 import smtplib from email.mime.text import MIMEText def SendMail(): mail_host = "smtp.163.com" #邮箱服务 mail_user = "xxx@163.com" #发件人邮箱 mail_pass 阅读全文
posted @ 2021-01-18 15:18 Mr.zou 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 问题 在处理传参的过程中,我每次都是使用固定的字典格式取值,却从来没想过用字符串的方式来获取value,以下是解决办法 eval() 函数用来执行一个字符串表达式,并返回表达式的值。 实例方法 #!/usr/bin/env python #-*- coding: utf-8 -*- import s 阅读全文
posted @ 2020-12-31 17:42 Mr.zou 阅读(580) 评论(0) 推荐(0) 编辑
摘要: 参考链接 https://blog.csdn.net/holderlinzhang/article/details/104260531 已经测试,有效。 阅读全文
posted @ 2020-12-17 10:16 Mr.zou 阅读(235) 评论(0) 推荐(0) 编辑
摘要: ansible-playbook 模板 执行模板 - name: use vars define variables hosts: 192.168.64.124 tasks: - name: add line before Listen 80 lineinfile: dest: /etc/hosts 阅读全文
posted @ 2020-12-02 11:08 Mr.zou 阅读(131) 评论(0) 推荐(0) 编辑
摘要: centos7 yum安装mariadb 10.2.4 https://blog.csdn.net/qq_34777982/article/details/105709096 阅读全文
posted @ 2020-10-21 10:15 Mr.zou 阅读(153) 评论(0) 推荐(0) 编辑