引用符で囲まれたテキストを示すために ">"行接頭辞を使用するテキストを折り返すために使用できるPythonモジュールまたは既存のPythonコードを探しています(下記の例を参照)。python:電子メールの慣行で引用されたテキストをラッピングするモジュールですか?
私はPython textwrapモジュールを使用して、段落のテキストを折り返すことができます。しかし、このモジュールはこの種の引用符を知らない。
私は、このテキストの折り返しを実行するルーチンをコード化する方法を知っています。それを書く方法についてのアドバイスはありません。むしろ、すでに存在し、電子メールタイプの引用されたテキストにこの種のラッピングをすでに実行できるPythonコードまたはPythonモジュールを知っている人がいるかどうかは疑問です。
私は検索していますが、私はPythonで何も見つかりませんでした。
このようなことが既に書かれている場合、私はちょうど "ホイールを再発明"したくありません。
ここでは、実行したいテキストラッピングの例を示します。私は、架空の電子メールメッセージから来て、次のテキストがあるとします。
Abc defg hijk lmnop.
Mary had a little lamb.
Her fleas were white as snow,
> Now is the time for all good men to come to the aid of their party.
>
> The quick
> brown fox jumped over the lazy sleeping dog.
>> When in the Course of human
>> events it
>> becomes necessary for one people to dissolve the political
>> bands
>> which have
>> connected them ...
and everywhere that Mary went,
her fleas were sure to go
... and to reproduce.
> What do you mean by this?
>> with another
>> and to assume among
>> the powers of the earth ...
> Doo wah diddy, diddy dum, diddy doo.
>> Text text text text text text text text text text text text text text text text text text text text text text text text text text text.
は結果のテキストは次のようになり、私は列52でラップしたいと仮定すると:
Abc defg hijk lmnop.
Mary had a little lamb. Her fleas were white as
snow,
> Now is the time for all good men to come to the
> aid of their party.
>
> The quick brown fox jumped over the lazy sleeping
> dog.
>> When in the Course of human events it becomes
>> necessary for one people to dissolve the
>> political bands which have connected them ...
and everywhere that Mary went, her fleas were
sure to go ... and to reproduce.
> What do you mean by this?
>> with another and to assume among the powers of
>> the earth ...
> Doo wah diddy, diddy dum, diddy doo.
>> Text text text text text text text text text text
>> text text text text text text text text text text
>> text text text text text text text.
すべての参照をありがとう既存のPythonコードに追加します。
「野生の中に」存在しない場合は、これを書いてコードを投稿します。
ありがとうございました。