{"id":13491942,"url":"https://github.com/jackzhenguo/python-small-examples","last_synced_at":"2025-05-13T20:09:42.795Z","repository":{"id":38206238,"uuid":"222183074","full_name":"jackzhenguo/python-small-examples","owner":"jackzhenguo","description":"告别枯燥，致力于打造 Python 实用小例子，更多Python良心教程见  https://ai-jupyter.com","archived":false,"fork":false,"pushed_at":"2024-06-26T16:37:35.000Z","size":5834,"stargazers_count":8041,"open_issues_count":2,"forks_count":1812,"subscribers_count":294,"default_branch":"master","last_synced_at":"2025-04-28T10:57:48.610Z","etag":null,"topics":["data-science","machine-learning","python","python-gui","python-web","pytorch","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackzhenguo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-17T01:47:01.000Z","updated_at":"2025-04-25T13:56:47.000Z","dependencies_parsed_at":"2024-01-14T06:59:13.914Z","dependency_job_id":"91b6bcbb-b7bc-40b0-a6a1-dcefa2545510","html_url":"https://github.com/jackzhenguo/python-small-examples","commit_stats":{"total_commits":144,"total_committers":6,"mean_commits":24.0,"dds":"0.13194444444444442","last_synced_commit":"aa11da6ac252f13bda7eaff976ca06446c70ef6d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackzhenguo%2Fpython-small-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackzhenguo%2Fpython-small-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackzhenguo%2Fpython-small-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackzhenguo%2Fpython-small-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackzhenguo","download_url":"https://codeload.github.com/jackzhenguo/python-small-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020606,"owners_count":22000753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","machine-learning","python","python-gui","python-web","pytorch","tensorflow"],"created_at":"2024-07-31T19:01:01.757Z","updated_at":"2025-05-13T20:09:42.764Z","avatar_url":"https://github.com/jackzhenguo.png","language":"Python","readme":"\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/-Python-brightgreen\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/-%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90-yellowgreen\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/-%E7%AE%97%E6%B3%95-yellow\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/-%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0-lightgrey\"\u003e\n\u003ca href=\"https://static01.imgkr.com/temp/c6e10a16c4764dcdb32587760f6769ec.png\" width=\"28%\"\u003e\u003cimg src=\"https://img.shields.io/badge/%E5%85%AC%E4%BC%97%E5%8F%B7-Python%E5%B0%8F%E4%BE%8B%E5%AD%90-orange\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n\u003c!-- \u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://static01.imgkr.com/temp/f379139a2c5d463799c35c1aa68911d7.png\" width=\"18%\"/\u003e\n\u003c/div\u003e --\u003e\n\u003c/div\u003e\n\n## 介绍\n\n告别枯燥，告别枯燥，致力于打造 Python 经典小例子、小案例。 \n\n## License\n\n允许按照要求转载，但禁止用于任何商用目的。如果转载本库小例子、小案例，请备注下方链接：\n\n[Python小例子所有汇总](https://ai-jupyter.com/python-small-examples/)\n\n### 更多教程\n\n[AI消息](https://ai-jupyter.com/)\n\n[AI新闻报道](https://ai-jupyter.com/ai-news-all/)\n\n[AI大模型](https://ai-jupyter.com/ai-llm/)\n\n[AI工具集](https://ai-jupyter.com/ai-chatgpt/)\n\n[ChatGPT4o免费使用六种方法](https://ai-jupyter.com/ai-chatgpt/)\n\n[Python教程](https://ai-jupyter.com/python-packages/)\n\n[数据分析教程](https://ai-jupyter.com/numpy-intro/)\n\n[算法教程](https://ai-jupyter.com/algorithm-basic/)\n\n[AI教程](https://ai-jupyter.com/statistics/)\n\n[Git教程](https://ai-jupyter.com/git/)\n\n[程序员](https://ai-jupyter.com/others/)\n\n[资料下载](https://ai-jupyter.com/python-20/)\n\n\n## Python 小例子\n\n### 基本操作\n\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n|1   | [常见算术运算](md/198.md)|\t运算  |\tv1|\t⭐⭐ |\n| 2    | [实现 relu](md/1.md) | max   | V4.0        | ⭐️⭐️ |\n| 3    | [进制转化](md/2.md)                | bin,oct,hex | V4.0            |  ⭐️⭐️|\n| 4    | [整数和ASCII互转](md/3.md)         | chr,ord | V1.0     | ⭐️⭐️ |\n| 5    | [元素都为真检查](md/4.md)          | all   | V2.0      | ⭐️⭐️⭐️ |\n| 6    | [至少一个为真检查](md/5.md)        | any | V2.0    | ⭐️⭐️⭐️ |\n| 7    | [判断是真是假](md/6.md)            | bool        | V2.0        | ⭐️⭐️⭐️ |\n| 8    | [创建复数](md/7.md)                | complex         | V1.0            | ⭐️⭐️⭐️ |\n| 9    | [取商和余数](md/8.md)              | divmod        | V1.0          | ⭐️⭐️ |\n| 10    | [转为浮点类型](md/9.md)            | float       | V1.0        | ⭐️⭐️ |\n| 11   | [转为整型](md/10.md)               | int            | V1.0           | ⭐️ |\n| 12   | [次幂](md/11.md)                   | pow                | V1.0               | ⭐️ |\n| 13   | [四舍五入](md/12.md)               | round          | V1.0           | ⭐️ |\n| 14   | [链式比较](md/13.md)               | compare       | V1.0           | ⭐️⭐️ |\n| 15   | [字符串转字节](md/14.md)           | bytes,utf-8 | V1.0       | ⭐️⭐️ |\n| 16   | [任意对象转为字符串](md/15.md)     | str  | V1.0 | ⭐️⭐️ |\n| 17   | [执行字符串表示的代码](md/16.md)   | compile | V1.0 | ⭐️⭐️⭐️ |\n| 18   | [计算表达式](md/17.md)             | eval         | V1.0         | ⭐️⭐️⭐️⭐️ |\n| 19   | [字符串格式化](md/18.md)           | format     | V1.0       | ⭐️⭐️⭐️⭐️ |\n| 20   | [交换两元素](md/23.md)             | pack,unpack | V1.0         | ⭐️⭐️ |\n| 21   | [转为字典](md/29.md)               | dict           | V1.0           | ⭐️⭐️ |\n| 22   | [冻结集合](md/30.md)               | frozenset | V1.0           | ⭐️⭐️ |\n| 23   | [转为集合类型](md/31.md)           | set        | V1.0       | ⭐️⭐️ |\n| 24   | [转元组](md/32.md)                 | tuple            | V1.0             | ⭐️⭐️ |\n| 25   | [查看变量所占字节数](md/48.md)  | getsizeof | V1.0 | ⭐️⭐️⭐️ |\n| 26 | [含单个元素的元组](md/154.md) | tuple | V1.0 | ⭐️⭐ |\n| 27 | [列表删除之坑](md/159.md) | list | V1.0 | ⭐️⭐ |\n| 28 | [列表快速复制之坑](md/160.md) | list  | V1.0 | ⭐️⭐⭐ |\n| 29 | [发现列表前3个最大或最小数](md/195.md) | list heapq | v1.0 | ⭐️⭐⭐⭐ |\n| 30 | [字符串驻留](md/161.md) | str  | V1.0 | ⭐️⭐⭐⭐⭐ |\n| 31 | [创建空集合错误](md/166.md) | set  | V1.0 | ⭐️⭐ |\n| 32 | [充分认识for](md/164.md) | for  | V1.0 | ⭐️⭐⭐ |\n| 33 | [认识执行时机](md/165.md) | generator  | V1.0 | ⭐️⭐⭐⭐⭐ |\n\n\n### 函数和模块常见用法\n\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n| 1   | [操作函数对象](md/24.md)           | operator   | V2.0       | ⭐️⭐️⭐️⭐️ |\n| 2   | [创建range序列](md/55.md) | range | V1.0 | ⭐️⭐️ |\n| 3   | [生成逆序序列](md/25.md)           | range | V1.0       | ⭐️⭐️ |\n| 4   | [拿来就用的排序函数](md/19.md)     | sorted | V1.0 | ⭐️⭐️⭐️ |\n| 5   | [求和函数](md/20.md)               | sum            | V1.0           | ⭐️⭐️ |\n| 6   | [函数的五类参数使用例子](md/26.md) | variable parameter | V2.0 | ⭐️⭐️⭐️⭐️ |\n| 7   | [使用slice对象](md/27.md)          | slice     | V2.0      | ⭐️⭐️⭐️⭐️⭐️ |\n| 8   | [lambda 函数](md/28.md)  | lambda | V3.0 | ⭐️⭐️⭐️⭐️ |\n| 9   | [枚举对象](md/47.md)       | enumerate | V1.0   | ⭐️⭐️⭐️ |\n| 10   | [过滤器filter](md/49.md)  | filter | V1.5 | ⭐️⭐️⭐️ |\n| 11   | [返回对象哈希值](md/50.md)    | hash | V1.0 | ⭐️⭐️ |\n| 12   | [带名字的元组](md/79.md) | namedtuple | V1.0 | ⭐️⭐️⭐️ |\n| 13   | [一行代码实现列表反转](md/70.md) | reverse | V1.0 | ⭐️⭐️ |\n| 14   | [反转字符串的两个方法](md/86.md) | reversed | V1.0 | ⭐️⭐️ |\n| 15   | [join 串联字符串](md/87.md) | join | V1.0 | ⭐️⭐️ |\n| 16   | [字符串字节长度](md/88.md) | encode | V1.0 | ⭐️⭐️ |\n| 17 | [groupby单字段分组](md/129.md) | itertools, groupby,lambda | V1.0 | ⭐️⭐️⭐️ |\n| 18 | [groupby多字段分组](md/130.md) | itemgetter,itertools,groupby | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 19 | [itemgetter和key函数](md/131.md) | operator,itemgetter,itertools | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 20 | [sum函数计算和聚合同时做](md/132.md) | sum,generator | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 21 | [默认参数设为空](md/155.md) | function | V1.0 | ⭐️⭐⭐ |\n| 22 | [各种参数使用之坑](md/158.md) | function paremeter | V1.0 | ⭐️⭐⭐ |\n| 23 | [lambda自由参数之坑](md/157.md) | lambda | V1.0 | ⭐️⭐⭐ |\n| 24 | [使用堆升序列表](md/196.md) | sort heapq | v1.0 | ⭐️⭐⭐⭐ |\n\n\n### 面向对象\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n| 1   | [所有对象之根](md/43.md)           | object     | V1.0       | ⭐️ |\n| 2   | [对象是否可调用](md/33.md)         | callable | V2.5   | ⭐️⭐️⭐️⭐️ |\n| 3   | [ascii 展示对象](md/34.md)         | `__repr__` | V2.5     | ⭐️⭐️⭐️ |\n| 4   | [类方法](md/35.md)                 | classmethod      | V1.5             | ⭐️⭐️⭐️ |\n| 5   | [动态删除属性](md/36.md)           | delattr,hasattr | V1.5       | ⭐️⭐️ |\n| 6   | [一键查看对象所有方法](md/37.md)   | dir | V1.5 | ⭐️⭐️ |\n| 7   | [动态获取对象属性](md/38.md)       | getattr | V1.5   | ⭐️⭐️ |\n| 8   | [对象是否有某个属性](md/39.md)     | hasattr | V1.5 | ⭐️⭐️⭐️ |\n| 9   | [对象门牌号](md/40.md)             | id           | V1.0         | ⭐️ |\n| 10   | [实例和对象关系判断](md/41.md)    | isinstance   | V1.5         | ⭐️⭐️⭐️ |\n| 11   | [issubclass父子关系鉴定](md/42.md) | issubclass | V1.5 | ⭐️⭐️⭐️ |\n| 12   | [创建属性的两种方法](md/44.md)     | property | V2.5 | ⭐️⭐️⭐️⭐️⭐️ |\n| 13   | [查看对象类型](md/45.md)           | type      | V1.0       | ⭐️ |\n| 14   | [元类使用介绍](md/46.md)     | type,`__class__` | V2.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 15 | [相同值的不可变对象](md/162.md) | mutable  | V1.0 | ⭐️⭐⭐ |\n| 16 | [对象销毁顺序](md/163.md) | OOP del   | V1.0 | ⭐️⭐⭐⭐ |\n| 17 | [子类继承父类的静态方法吗？](md/171.md) | staticmethod | V1.0 | ⭐️⭐⭐ |\n\n\n\n### 正则\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n| 1   | [正则中字符 `r`作用](md/89.md) | re,r | V3.0 | ⭐️⭐️⭐️ |\n| 2   | [正则原子操作](md/90.md) | re | V3.0 | ⭐️⭐️⭐️ |\n| 3   | [正则中的转义](md/91.md) | re,\\ | V3.0 | ⭐️⭐️⭐️ |\n| 4   | [正则最普通查找](md/92.md) | re,findall | V3.0 | ⭐️⭐️⭐️ |\n| 5   | [使用通用字符查找](md/93.md) | re,\\s,\\w,\\d | V3.0 | ⭐️⭐️⭐️ |\n| 6   | [使用元字符查找](md/94.md) | re,+,* | V3.0 | ⭐️⭐️⭐️ |\n| 7   | [捕获子串](md/95.md) | () | V3.0 | ⭐️⭐️⭐️⭐️ |\n| 8   | [贪心捕获和非贪心捕获](md/96.md) | re | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 9   | [使用正则做密码安全检查](md/97.md) | re | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 10   | [爬取百度首页标题](md/98.md) | re | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 11   | [批量转化为驼峰格式(Camel)](md/99.md) | re | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 12   | [使用正则判断是否为正浮点数](md/102.md) | str,re,float | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 13 | [使用正则提取正整数和大于0的浮点数](md/197.md) | re findall | v2 | ⭐️⭐⭐⭐ |\n\n### 装饰器迭代器生成器\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n| 1 | [通俗理解装饰器](md/138.md) | decorator | V1.0 | ⭐️⭐️⭐️ |\n| 2 | [测试函数运行时间的装饰器](md/136.md) | decorator | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 3 | [统计异常次数装饰器](md/137.md) | decorator,nonlocal | V1.5 | ⭐️⭐️⭐️⭐️ |\n| 4 | [定制递减迭代器](md/139.md) | Iterator | V3.0 | ⭐️⭐️⭐️⭐️ |\n| 5   | [创建迭代器](md/53.md)      | iter,`__iter__` | V1.5  | ⭐️⭐️⭐️ |\n| 6   | [反向迭代器reversed](md/56.md) | reversed | V1.0 | ⭐️⭐️ |\n| 7   | [zip迭代器](md/57.md)     | zip  | V1.5 | ⭐️⭐️⭐️ |\n| 8 | [list分组(生成器版)](md/134.md) | yield,generator | V1.0 | ⭐️⭐️⭐️ |\n| 9 | [列表全展开(生成器版)](md/135.md) | list,yield,generator | V1.0 | ⭐️⭐️⭐️ |\n| 10   | [chain串联小容器为大容器](md/84.md) | itertools,chain | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 11   | [product 使用案例](md/85.md) | product | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 12 | [斐波那契数列前n项](md/126.md) | yield,range | V1.0 | ⭐️⭐️⭐️ |\n\n\n### 绘图\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n| 1 | [turtle绘制奥运五环图](md/140.md) | turtle | V1.0 | ⭐️⭐️⭐️ |\n| 2 | [turtle绘制漫天雪花](md/141.md) | turtle | V1.0 | ⭐️⭐️⭐️ |\n| 3 | [Python词云图](md/142.md) | WordCloud | V1.0 | ⭐️⭐️⭐ |\n| 4 | [Plotly柱状图和折线图](md/143.md) | plotly | V1.0 | ⭐️⭐ |\n| 5 | [seaborn热力图](md/144.md) | seaborn | V1.0 | ⭐️⭐ |\n| 6 | [Pyecharts仪表盘](md/145.md) | pyecharts | V1.0 | ⭐️⭐ |\n| 7 | [Pyecharts漏斗图](md/146.md) | pyecharts | V1.0 | ⭐️⭐ |\n| 8 | [Pyecharts水球图](md/147.md) | pyecharts | V1.0 | ⭐️⭐ |\n| 9 | [Pyecharts饼图](md/148.md) | pyecharts | V1.0 | ⭐️⭐ |\n| 10 | [Pyecharts极坐标图](md/149.md) | pyecharts | V1.0 | ⭐️⭐ |\n| 11 | [Pyecharts词云图](md/150.md) | pyecharts | V1.0 | ⭐️⭐ |\n| 12 | [Pyecharts热力图](md/151.md) | pyecharts | V1.0 | ⭐️⭐ |\n| 13 | [matplotlib绘制动图](md/152.md) | matplotlib | V1.0 | ⭐️⭐ |\n| 14 | [seaborn pairplot图](md/153.md) | seaborn | V1.0 | ⭐️⭐⭐⭐ |\n| 15 | [pyecharts传入Numpy数据绘图失败](md/167.md) | numpy pyecharts  | V1.0 | ⭐️⭐⭐ |\n| 16 | [图像处理包pillow](md/169.md) | pillow  | V1.0 | ⭐️⭐⭐ |\n\n### 数据分析\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n| 1 | [数据分析神器：deepnote](./md/177.md) | deepnote | v1.0 | ⭐️⭐⭐ |\n| 2 | [NumPy 的pad填充方法](md/172.md) | NumPy pad | V1.0 | ⭐️⭐⭐⭐ |\n| 3 | [创建下对角线为1、2、3、4的对角矩阵](md/173.md) | NumPy diag | V1.0 | ⭐️⭐⭐ |\n| 4 | [cut 数据分箱](md/174.md) | Pandas cut | v1.0 | ⭐️⭐⭐ |\n| 5 | [丢弃空值和填充空值](./md/175.md) | Pandas dropna fillna | v1.0 | ⭐️⭐⭐ |\n| 6 | [apply 方法去掉特殊字符](./md/178.md) | pandas apply | v1.0 | ⭐️⭐⭐ |\n| 7 | [使用map对列做特征工程](./md/179.md) | pandas map | v1.0 | ⭐️⭐⭐ |\n| 8 | [category列转数值](./md/180.md) | pandas category | v1.0 | ⭐️⭐⭐ |\n| 9 | [rank排名](./md/181.md) | pandas rank | v1.0 | ⭐️⭐⭐|\n| 10 | [完成数据下采样，调整步长由小时为天](./md/182.md) | pandas resample | v1.0 | ⭐️⭐⭐ |\n| 11 | [如何用 Pandas 快速生成时间序列数据](./md/183.md) | pandas util | v1.0 | ⭐️⭐⭐ |\n| 12 | [如何快速找出 DataFrame 所有列 null 值个数](./md/184.md) | pandas isnull sum | v1.0 | ⭐️⭐⭐ |\n| 13 | [重新排序 DataFrame 的列](./md/185.md) | pandas dataframe | v1.0 | ⭐️⭐⭐ |\n| 14 | [使用 count 统计词条 出现次数](./md/186.md) | pandas count | v1.0 | ⭐️⭐⭐ |\n| 15 | [split 求时分(HH:mm)的分钟差](./md/187.md) | pandas split | v1.0 | ⭐️⭐⭐ |\n| 16 | [melt透视数据小技巧](./md/188.md) | pandas melt | v1.0 | ⭐️⭐⭐ |\n| 17 | [pivot 透视小技巧](./md/189.md) | pandas melt | v1.0 | ⭐️⭐⭐ |\n| 18 | [p随机读取文件的K行，生成N个](./md/190.md) | pandas sample | v1.0 | ⭐️⭐⭐ |\n| 19 | [格式化Pandas的时间列](md/191.md) | pandas apply | v1.0 | ⭐️⭐⭐⭐ |\n\n### 其他常用\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n| 1   | [help 一键帮助](md/51.md)  | help | V1.0 | ⭐️ |\n| 2   | [获取用户输入](md/52.md)     | input | V1.0 | ⭐️ |\n| 3   | [文件读写和mode 取值表](md/54.md) | open,read,write,with,mode | V2.0 | ⭐️⭐️⭐️ |\n| 4   | [operator使用举例](md/58.md) | operator | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 5   | [传输json对象](md/59.md)  | json | V2.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 6   | [获取文件后缀名](md/103.md) | os,splitext | V1.0 | ⭐️⭐️ |\n| 7   | [获取路径中的文件名](md/104.md) | os,split | V1.0 | ⭐️⭐️ |\n| 8   | [批量修改文件后缀](md/105.md) | argparse,listdir | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 9   | [xls批量转换成xlsx](md/106.md) | os,listdir,splitext | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 10   | [获取指定后缀名的文件](md/107.md) | os,listdir,splitext | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 11   | [批量压缩文件](md/108.md) | zipfile | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 12   | [32位加密](md/109.md) | hashlib | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 13   | [年的日历图](md/110.md) | calendar | V1.0 | ⭐️⭐️ |\n| 14   | [判断是否为闰年](md/111.md) | calendar | V1.0 | ⭐️⭐️⭐️ |\n| 15   | [判断月有几天](md/112.md) | calendar,datetime | V1.0 | ⭐️⭐️⭐️ |\n| 16   | [月的第一天](md/113.md) | datetime | V1.0 | ⭐️⭐️ |\n| 17 | [月的最后一天](md/114.md) | calendar,datetime | V1.0 | ⭐️⭐️ |\n| 18 | [获取当前时间](md/115.md) | time,datetime | V1.0 | ⭐️⭐️ |\n| 19 | [字符时间转时间](md/116.md) | time,datetime | V1.0 | ⭐️⭐️ |\n| 20 | [时间转字符时间](md/117.md) | time,datetime | V1.0 | ⭐️⭐️ |\n| 21 | [获得某天后的1~n天](md/133.md) | Calendar,monthrange | V4.0 | ⭐️⭐️⭐️ |\n| 22 | [默认启动主线程](md/118.md) | threading | V1.0 | ⭐️⭐️ |\n| 23 | [创建线程](md/119.md) | threading | V1.0 | ⭐️⭐️ |\n| 24 | [交替获得CPU时间片](md/120.md) | threading | V1.0 | ⭐️⭐️⭐️ |\n| 25 | [多线程抢夺同一个变量](md/121.md) | threading | V1.0 | ⭐️⭐️⭐️ |\n| 26 | [多线程变量竞争引起的问题](md/122.md) | threading | V1.0 | ⭐️⭐️⭐️ |\n| 27 | [多线程锁](md/123.md) | threading,lock | V1.0 | ⭐️⭐️⭐️ |\n| 28 | [时间转数组及常用格式](md/124.md) | time,datetime,format | V1.0 | ⭐️⭐️⭐️ |\n| 29   | [nonlocal用于内嵌函数中](md/21.md) | nonlocal | V2.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 30   | [global 声明全局变量](md/22.md)    | global | V2.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 31 | [共享变量未绑定之坑](md/156.md) | global | V1.0 | ⭐️⭐⭐ |\n| 32 | [优化代码异常输出包](md/168.md) | debugger  | V1.0 | ⭐️⭐⭐ |\n| 33 | [一行代码找到编码](md/170.md) | chardet  | V1.0 | ⭐️⭐⭐ |\n| 34 | [创建SQLite连接](md/192.md) | SQLite | v1.0 | ⭐️⭐⭐⭐ |\n| 35 | [json对象转python对象](md/193.md) | python json | v1.0 | ⭐️⭐⭐⭐ |\n| 36 | [python对象转json对象](md/194.md) | python json | v1.0 | ⭐️⭐⭐⭐ |\n| 37 | [一行代码让 pip 安装加速 100 倍](md/176.md) | pip install | v1.0 | ⭐️⭐⭐ |\n\n\n### 工作常用案例\n| 小例子 | 链接                    | 标签              | 版本          | 难度 |\n| ---- | ---------------------------------- | ---- | ---- | ---- |\n| 1   | [不用else和if实现计算器](md/60.md) | operator | V1.0 | ⭐️⭐️⭐️ |\n| 2   | [去最求平均](md/61.md)      | list,sort,round | V1.0  | ⭐️⭐️⭐️⭐️ |\n| 3   | [打印99乘法表](md/62.md)    | for,range,format | V1.0 | ⭐️⭐️⭐️ |\n| 4   | [递归版flatten函数](md/63.md) | recursion,list,isinstance | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 5   | [列表等分为n份](md/64.md)  | list,ceil | V1.0 | ⭐️⭐️⭐️ |\n| 6   | [压缩列表](md/65.md)       | list,filter | V1.0   | ⭐️⭐️⭐️⭐️ |\n| 7   | [求更长的列表](md/66.md)     | max,lambda | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 8   | [求列表众数](md/67.md)     | max,lambda,count | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 9   | [所有多个列表的最大值](md/68.md) | max,lambda | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 10   | [列表检查重复](md/69.md)     | set  | V1.0 | ⭐️⭐️⭐️ |\n| 11   | [浮点数等差数列](md/71.md)    | range,float | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 12   | [按条件分组](md/72.md)      | lambda | V1.0  | ⭐️⭐️⭐️⭐️ |\n| 13   | [map实现向量运算](md/73.md)  | map,lambda | V1.0 | ⭐️⭐️⭐️ |\n| 14   | [值最大的字典](md/74.md)     | max,lambda | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 15   | [合并两个字典](md/75.md)     | **   | V1.0 | ⭐️⭐️⭐️ |\n| 16   | [Topn 字典](md/76.md)    | heapq,nlargest | V1.0 | ⭐️⭐️⭐️ |\n| 17   | [判断是否为异位词](md/77.md) | collections,Counter | V1.0 | ⭐️⭐️⭐️ |\n| 18   | [逻辑上合并字典](md/78.md) | ChainMap | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 19   | [sample 样本抽样](md/80.md) | random,sample | V1.0 | ⭐️⭐️⭐️ |\n| 20   | [重洗数据集](md/81.md) | shuffle | V1.0 | ⭐️⭐️⭐️ |\n| 21   | [10个均匀分布的坐标点](md/82.md) | random,uniform | V1.0 | ⭐️⭐️⭐️ |\n| 22   | [10个高斯分布的坐标点](md/83.md) | random,gauss | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 23   | [是否互为排序词](md/100.md) | collections,defaultdict | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 24   | [str1是否由str2旋转而来](md/101.md) | str | V1.0 | ⭐️⭐️⭐️ |\n| 25 | [寻找第n次出现位置](md/125.md) | enumerator | V1.0 | ⭐️⭐️⭐️ |\n| 26 | [找出所有重复元素](md/127.md) | calendar,datetime | V1.0 | ⭐️⭐️⭐️⭐️ |\n| 27 | [联合统计次数](md/128.md) | Counter | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 28 | [求两点球面距离](md/199.md) | math asin | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 29 | [获取文件编码](md/200.md) | chardet | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n| 30 | [格式化json串](md/201.md) | json | V1.0 | ⭐️⭐️⭐️⭐️⭐️ |\n\n\n\n\n","funding_links":[],"categories":["Python","HarmonyOS","Python 程序"],"sub_categories":["Windows Manager","网络服务_其他"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackzhenguo%2Fpython-small-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackzhenguo%2Fpython-small-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackzhenguo%2Fpython-small-examples/lists"}