with tutorial the framework español applications python text format fwrite

python - tutorial - the django project



¿Hay alguna manera de escribir texto formateado desde Python? (1)

Solo he estado jugando con esta palabra asumiendo MS, encontré que necesitaba envolver el documento en ''{}'' y definir el tipo de documento, luego comenzar en negrita con ''/ b'' y terminar con ''/ b0''. Un ejemplo sería

test = ''tester.rtf'' out_file = open(test,''w'') out_file.write("""{//rtf1 This is //b Bold //b0/line/ }""") out_file.close() #thanks to the comment below

Tenga en cuenta el doble ''/' ya que python tiene un significado especial para ''/ b'' y ''/ r''.

La información completa proviene de http://www.pindari.com/rtf1.html , que también describe cursivas, fuentes, etc.

Avíseme si eso funcionó para usted.

Si está escribiendo en un archivo con Python, ¿hay alguna forma de hacer que ciertas partes del texto sean negritas, cursivas o subrayadas?

Lo intenté:

test = ''/location/tester.rtf'' out_file = open(test,''w'') out_file.write(''is this {/bold}?'') out_file.close() #thanks to the comment below

¿Es posible escribir FORMATTED TEXT como texto en negrita, cursiva o subrayado a través de python? Siento que .rtf es el texto con el formato más básico, pero corrígeme si me equivoco