你做了有趣的Python系统实用程序吗?

2024-06-02 15:18:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我慢慢地但肯定地在自学Python。我从实践中学到了最好的东西。我正在寻找一些整洁的系统生产力类型的程序,我可以尝试使你发现有用的你自己。我成功制作和使用的一些模块如下:

  • 压缩文件夹
  • 将一整套文件夹压缩到存档中作为自动备份
  • 在启动时打开我最常用的程序的应用程序启动程序

但我现在有点卡住了。我还能做什么?在


Tags: 模块程序文件夹应用程序类型系统备份生产力
3条回答

另一个想法:从“joelonsoftware”中读取The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!),然后编写一个实用程序来扫描系统上的所有HTML文件,并确保它们被正确编码。也就是说,确保页面声明的内容类型与实际使用的内容类型相同。在

使用Python2.5,我编写了一个脚本,用于转储我的Subversion存储库,压缩转储文件,并将scp的转储文件转移到两个备份服务器上。把备份结果发邮件给我。这是每天都要做的。做了这些之后,我意识到我有多么喜欢Python,它有多么强大。在

下一步是修改脚本以使用rsync,并通过一些网站备份进行复制。在

当然向我展示了Python的实用性。在

我写了一个脚本,用我手机的蓝牙ID作为一种物理安全令牌。当电脑(Windows)从睡眠状态恢复时,它会扫描附近的蓝牙设备,如果找不到我的手机,就会锁定工作站。在

老掉牙的,不太安全,但符合目的。在

"""
Intended to run on Windows resume. Scans for bluetooth devices and if a 
particular device is not present, locks the computer.
"""
import bluetooth
import ctypes
import sys

# Bluetooth UID of "token" device
wanted = "XX:XX:XX:XX:XX:XX"

print "performing inquiry..."

# Hack.... if 0 devices are present, pybluez throws an exception
passed = False
try:
    discovered = bluetooth.discover_devices()
    if wanted in discovered:
        print "Found phone"
        passed = True
    else:
        passed = False
except:
    passed = False

if not passed:
    print "Locking"
    ctypes.windll.user32.LockWorkStation()

要求:

  1. pybluez用于蓝牙
  2. Hibernate Trigger计划任务在恢复时运行。在

相关问题 更多 >