4
如果您正在使用python写入文件,是否有任何方法使文本的某些部分变为粗体,斜体或下划线?有没有办法从Python编写格式化文本?
我想:
test = '/location/tester.rtf'
out_file = open(test,'w')
out_file.write('is this {\bold}?')
out_file.close() #thanks to the comment below
是有可能写格式的文本如粗体,斜体,或通过Python下划线的文本?我觉得.rtf是最基本的格式化文本,但纠正我,如果我错了
1)在标题中提出真正的问题:“如何使用Python编写RTF文件?” (或者任何期望的格式;例如DOC,DOCX,Open Office使用的任何等等)和2)包括错误症状(通常包括错误消息)。 – user2246674 2013-04-23 06:01:43
你必须'out_file.close()'才能再次打开它。 – Volatility 2013-04-23 06:01:44