Python高效编程技巧
Maybe you have known some basic grammars of Python, and you can try out what you want to do with what you know. It’s still good for you to learn some advanced skills. Here are some high-level technologies covering data structure, algorithm, decorator, multi-threading, iterator, parsing, IO operation, class & object and string, etc. With these efficient programming methods, you will no doubt find out a easier way to solve your problem.
Btw, this is not a completed project. The Github repository hosting these ipynb files is in a continually updating status, so is this blog. You can access to the jupyter notebook files by clicking the headers.
1. Python高效编程技巧1
- 如何在列表、字典、集合中根据条件筛选数据?
- 如何为元组中的每个元素命名,提高程序的可读性?
- 如何统计序列中元素的出现频率?
- 如何根据字典中值的大小,对字典中的项进行排序
- 如何快速找到多个字典中的公共键(key)
- 如何让字典保持有序
- 如何实现用户的历史记录功能(最多n条)
- 如何实现可迭代对象和迭代器对象?
- 如何使用生成器函数实现可迭代对象?
2. Python高效编程技巧2
- 如何进行反向迭代以及如何实现反向迭代?
- 如何对迭代器做切片操作?
- 如何在一个for语句中迭代多个可迭代对象?
- 如何拆分含有多种分隔符的字符串?
- 如何判断字符串a是否以字符串b开头或结尾?
- 如何调整字符串中文本的格式?
- 如何将多个小字符串拼接成一个大字符串?
- 如何对字符串进行左、右、中对齐?
- 如何去掉字符串中不需要的字符?
The theme of these days: Keeping catching up!
Written on July 24, 2018