gpt4 book ai didi

python - 提取 Debian 软件包的描述

转载 作者:行者123 更新时间:2023-12-01 06:01:05 25 4
gpt4 key购买 nike

我正在尝试使用 Python 从 Packages.gz 文件中提取 debian 软件包的描述。有没有办法只获取包的描述,即“描述:”字段后的内容。

源文件是:

Package: 2vcard
Priority: optional
Section: utils
Installed-Size: 108
Maintainer: Martin Albisetti <argentina@gmail.com>
Architecture: all
Version: 0.5-3
Filename: pool/main/2/2vcard/2vcard_0.5-3_all.deb
Size: 14300
MD5sum: d831fd82a8605e9258b2314a7d703abe
SHA1: e903a05f168a825ff84c87326898a182635f8175
SHA256: 2be9a86f0ec99b1299880c6bf0f4da8257c74a61341c14c103b70c9ec04b10ec
Description: perl script to convert an addressbook to VCARD file format
2vcard is a little perl script that you can use to convert the
popular vcard file format. Currently 2vcard can only convert addressbooks
and alias files from the following formats: abook,eudora,juno,ldif,mutt,
mh and pine.
.
The VCARD format is used by gnomecard, for example, which is used by the
balsa email client.
Tag: implemented-in::perl, role::program, use::converting

最佳答案

也许http://pypi.python.org/pypi/python-debian有帮助吗?

具体来说,假设data是一个包含源文件内容的字符串,那么:

from debian import deb822
print deb822.Deb822(data.split("\n"))['Description']

将输出描述

关于python - 提取 Debian 软件包的描述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10428555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com