
python
Hacker_xiao
用心做!
展开
-
Python多线程执行并返回结果
# -*-coding:utf-8-*- import time from time import ctime, sleep import threading import collections class MyThread(threading.Thread): def __init__(self, func, args, name=''): threading.T...原创 2020-01-15 18:38:31 · 1246 阅读 · 1 评论 -
Python发送QQ邮件
# coding=utf-8 import logging import smtplib # 引入SMTP协议包 from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart # 创建包含多个部分的邮件体 from email.mime.image import MIMEImage # ...原创 2020-01-15 10:03:23 · 219 阅读 · 0 评论 -
Python生成图片验证码
安装PIL包 pip install pillow 生成验证码代码 # 图片验证码 import base64 import random from PIL import Image, ImageDraw, ImageFont from io import BytesIO # 生成随机的子母(大写小写)和数字 def getRandomChar(): random_num =...原创 2020-01-14 09:34:58 · 265 阅读 · 0 评论 -
python 列表字典排序
python列表字典数据类型排序: 排序方式为: task_info = [{''urgent":"2019-8-26", "task_run_time":"2019-7-23"},..............] task_info = sorted(task_info, key=operator.itemgetter('urgent', 'task_run_time')) #可以以多个字...原创 2019-09-26 12:37:29 · 205 阅读 · 0 评论