- 博客(11)
- 收藏
- 关注
原创 Python开发邮件脚本
在日常工作中,有许多邮件需要定时发送,python中的email和smtplib模块可以很好的解决邮件发送的问题。 一般邮件发送主要有如下的几种情况: 1. 发送纯文本消息 2. 发送HTML消息 3. 发送附件 SMTP是发送邮件的协议,Python内置对SMTP的支持,可以发送纯文本邮件、HTML邮件以及带附件的邮件。 smtplib:负责发送邮件。 email:负责构造邮件。 导入相关包 import os from email.mime.multipart import MIMEMultipart
2021-04-20 16:15:50
149
1
原创 并查集 (Union Find)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/11/6 15:40 # @FileName: UnionFind.py # @Description: class UnionFind(object): def __init__(self, n): # 根节点个数 self.root_num = n self.parent
2020-11-06 16:08:44
659
1
原创 堆排序(Heap Sort)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/10/23 15:01 # @FileName: heap_sort.py # @Description: def heap_sort(alist): length = len(alist) # 倒序对每个非叶子节点进行堆排序 for i in range(length // 2 - 1, -1, -1):
2020-10-23 15:10:21
116
原创 选择排序(Selection Sort)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/10/23 10:28 # @FileName: selection_sort.py # @Description: def selection_sort(alist): for i in range(len(alist) - 1): index = 0 for j in range(1,
2020-10-23 10:29:51
82
原创 栈的应用之括号匹配
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/9/28 15:48 # @FileName: per_checker.py # @Description: 判断括号是否匹配 { { ( [ ] [ ] ) } ( ) } from algorithms.datastruct.Stack import Stack def par_checker(symbol_string)
2020-09-28 16:03:34
76
原创 栈
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/9/28 15:42 # @FileName: Stack.py # @Description: class Stack(): def __init__(self): self.items = [] def is_empty(self): return self.items ==
2020-09-28 15:44:29
53
原创 快速排序(Quick Sort)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/9/15 17:07 # @FileName: 07_quick_sort.py # @Description: def quick_sort(alist): quick_sort_helper(alist, 0, len(alist) - 1) def quick_sort_helper(alist, first,
2020-09-15 17:22:40
111
原创 归并排序(Merge Sort)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/9/15 15:37 # @FileName: 07_merge_sort.py # @Description: def merge_sort(alist): if len(alist) <= 1: return alist mid = len(alist) // 2 left =
2020-09-15 16:57:02
77
原创 谢尔排序(Shell Sort)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/9/15 15:06 # @FileName: 07_shell_sort.py # @Description: def shell_sort(alist): sublist_count = len(alist) // 2 while sublist_count > 0: for star
2020-09-15 15:22:23
138
原创 插入排序 (Insertion Sort)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/9/15 14:43 # @FileName: 07_insertion_sort.py # @Description: def insertion_sort(alist): for i in range(1, len(alist)): current_value = alist[i] po
2020-09-15 14:51:21
73
原创 冒泡排序(Bubble Sort)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : guangxu.qi # @Time : 2020/9/15 14:27 # @FileName: bubble_sort.py # @Description: def bubble_sort(alist): for i in range(len(alist) - 1): for j in range(len(alist) - 1 - i):
2020-09-15 14:34:52
126
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人