1

Python を使用して Packages.gz ファイルから debian パッケージの説明を抽出しようとしています。パッケージの説明、つまり Description: フィールドの後の内容のみを取得する方法はありますか。

ソースファイルは次のとおりです。

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
4

1 に答える 1

2

たぶんhttp://pypi.python.org/pypi/python-debianが役立つでしょうか?

data詳細には、 がソース ファイルの内容を含む文字列であると仮定すると、次のようになります。

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

説明を出力します

于 2012-05-03T09:41:08.270 に答える