首页 > 文章列表 > Python大师的实用脚本收集

Python大师的实用脚本收集

Python 代码 脚本
216 2023-05-01

Python这门语言很适合用来写些实用的小脚本,跑个自动化、爬虫、算法什么的,非常方便。

这也是很多人学习Python的乐趣所在,可能只需要花个礼拜入门语法,就能用第三方库去解决实际问题。

我在Github上就看到过不少Python代码的项目,几十行代码就能实现一个场景功能,非常实用。

Python大师的实用脚本收集

比方说仓库Python-master里就有很多不错的实用Python脚本,举几个简单例子:

1. 创建二维码

5. 打印图片分辨率def jpeg_res(filename):
 """"This function prints the resolution of the jpeg image file passed into it"""

 # open image for reading in binary mode
 with open(filename,'rb') as img_file:

 # height of image (in 2 bytes) is at 164th position
 img_file.seek(163)

 # read the 2 bytes
 a = img_file.read(2)

 # calculate height
 height = (a[0] 

这个项目只是作者平时工作用到的一些小脚本,可能也会帮助到你。作者虽然不是程序员,但他这种用代码解决问题的习惯会极大的提升效率,也会迸发出更多的创新思维。我觉得这样的代码每个人都可以写出来,只要慢慢积累多练习就可以。