Skip to main content
 首页 » 编程设计

python之如何使用任何库在 python 中将 RTF 字符串转换为纯文本

2025年05月04日2398°冷暖

<分区>

我想在不使用正则表达式的情况下将 rtf 字符串转换为纯文本

rtfstring = '{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0 Arial;}}{\colortbl;\red255\green0\blue0;\red1\green1\blue1;}\viewkind4\uc1\pard\f0\fs18 {\b Amount/complexity of data to be reviewed:\b0}\par{- Review and summarization of old records}\par}' 

将是纯文本

Plaintext = "Amount/complexity of data to be reviewed:- Review and summarization of old records"