[转]50个很棒的Python模块

本文精选了50个Python模块,覆盖数据库、GUI、图像处理、网络等多个领域,为Python开发者提供全面的技术支持。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Python具有强大的扩展能力,我列出了50个很棒的Python模块,包含几乎所有的需要:比如Databases,GUIs,Images, Sound, OS interaction, Web,以及其他。推荐收藏。 

Graphical interface wxPython http://wxpython.org   
Graphical interface pyGtk http://www.pygtk.org   
Graphical interface pyQT http://www.riverbankcomputing.co.uk/pyqt/   
Graphical interface Pmw http://pmw.sourceforge.net/   
Graphical interface Tkinter 3000 http://effbot.org/zone/wck.htm   
Graphical interface Tix http://tix.sourceforge.net/   
        
Database MySQLdb http://sourceforge.net/projects/mysql-python   
Database PyGreSQL http://www.pygresql.org/   
Database Gadfly http://gadfly.sourceforge.net/   
Database SQLAlchemy http://www.sqlalchemy.org/   
Database psycopg http://www.initd.org/pub/software/psycopg/   
Database kinterbasdb http://kinterbasdb.sourceforge.net/   
Database cx_Oracle http://www.cxtools.net/default.aspx?nav=downloads   
Database pySQLite http://initd.org/tracker/pysqlite   
        
MSN Messenger msnlib http://auriga.wearlab.de/~alb/msnlib/   
MSN Messenger pymsn http://telepathy.freedesktop.org/wiki/Pymsn   
MSN Messenger msnp http://msnp.sourceforge.net/   
Network Twisted http://twistedmatrix.com/   
Images PIL http://www.pythonware.com/products/pil/   
Images gdmodule http://newcenturycomputers.net/projects/gdmodule.html   
Images VideoCapture http://videocapture.sourceforge.net/   
        
Sciences and Maths scipy http://www.scipy.org/   
Sciences and Maths NumPy http://numpy.scipy.org/   
Sciences and Maths numarray http://www.stsci.edu/resources/software_hardware/numarray   
Sciences and Maths matplotlib http://matplotlib.sourceforge.net/   
        
Games Pygame http://www.pygame.org/news.html   
Games Pyglet http://www.pyglet.org/   
Games PySoy http://www.pysoy.org/   
Games pyOpenGL http://pyopengl.sourceforge.net/   
        
Jabber jabberpy http://jabberpy.sourceforge.net/   
        
Web scrape http://zesty.ca/python/scrape.html   
Web Beautiful Soup http://crummy.com/software/BeautifulSoup   
Web pythonweb http://www.pythonweb.org/   
Web mechanize http://wwwsearch.sourceforge.net/mechanize/   
        
Localisation geoname.py http://www.zindep.com/blog-zindep/Geoname-python/   
        
Serial port pySerial http://pyserial.sourceforge.net/   
Serial port USPP http://ibarona.googlepages.com/uspp   
        
Parallel Port pyParallel http://pyserial.sourceforge.net/pyparallel.html   
        
USB Port pyUSB http://bleyer.org/pyusb/   
        
Windows ctypes http://starship.python.net/crew/theller/ctypes/   
Windows pywin32 http://sourceforge.net/projects/pywin32/   
Windows pywinauto http://www.openqa.org/pywinauto/   
Windows pyrtf http://pyrtf.sourceforge.net/   
Windows wmi http://timgolden.me.uk/python/wmi.html   
        
PDA/GSM/Mobiles pymo http://www.awaretek.com/pymo.html   
PDA/GSM/Mobiles pyS60 http://sourceforge.net/projects/pys60   
        
Sound pySoundic http://pysonic.sourceforge.net/   
Sound pyMedia http://pymedia.org/   
Sound FMOD http://www.fmod.org/   
Sound pyMIDI http://www.cs.unc.edu/Research/assist/developer.shtml   
        
GMail libgmail http://libgmail.sourceforge.net/   
Google pyGoogle http://pygoogle.sourceforge.net/   
Expect pExpect http://pexpect.sourceforge.net/   
WordNet pyWordNet http://osteele.com/projects/pywordnet/   
Command line cmd http://blog.doughellmann.com/2008/05/pymotw-cmd.html   
Compiler backend llvm-py http://mdevan.nfshost.com/llvm-py/   
3D VPython http://vpython.org

好的,这是一个很棒的问题。下面是我的建议: 1. 我们需要读取《哈姆雷特》英文剧本的文件,并将其存储为字符串,与上一个问题相同。 2. 我们需要对文本进行处理,将其中的标点符号、换行符等去除,并将所有的单词换为小写形式。同样与上一个问题相同。 3. 我们需要找到所有的人物名字,并统计他们出现的次数。这可以使用正则表达式来完成。 4. 接下来,我们可以使用Python的Counter函数,快速统计每个人物名字出现的次数。 5. 我们可以将统计结果按照出现次数进行排序,并输出前10个出现次数最多的人物名字。 6. 最后,我们可以使用turtle模块绘制柱状图,将统计结果以柱状图的形式展示出来。 下面是代码示例: ```python import re import turtle from collections import Counter def draw_bar(t, height): """绘制柱状图""" t.begin_fill() # 开始填充颜色 t.left(90) t.forward(height) t.write(str(height)) t.right(90) t.forward(40) t.right(90) t.forward(height) t.left(90) t.end_fill() # 结束填充颜色 def draw_axes(t): """绘制坐标轴""" t.pensize(3) t.penup() t.goto(-200, -150) t.pendown() t.goto(-200, 150) t.goto(200, 150) def word_count(file_path, num): # 读取文件内容 with open(file_path, 'r') as f: text = f.read() # 预处理文本 text = text.lower() text = text.replace('\n', ' ') text = ''.join(c for c in text if c.isalpha() or c == ' ') # 寻找人物名字 pattern = r'[A-Z][a-z]+(?:\s[A-Z][a-z]+)*' + r'(?:\s\([A-Za-z ]+\))?' characters = re.findall(pattern, text) # 统计人物出现次数 char_count = Counter(characters) # 按照出现次数排序 char_count = sorted(char_count.items(), key=lambda x: x[1], reverse=True) # 输出前num个人物及其出现次数 for i in range(num): print(char_count[i]) # 绘制柱状图 t = turtle.Turtle() t.speed(0) draw_axes(t) for i in range(num): t.penup() t.goto(-180, -125 + i * 50) t.write(char_count[i][0]) t.goto(-150, -150 + i * 50) t.pendown() t.color("red", "yellow") draw_bar(t, char_count[i][1]) turtle.done() # 示例调用 word_count('hamlet.txt', 10) ``` 注意,这里我们假设《哈姆雷特》英文剧本的文件名为'hamlet.txt',并输出出现频率前10的人物名字。你可以根据你的实际需求进行修改。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值