Friday, 15 January 2010

Python - Write to file with color and font -


I would like to write a file using gray text and liberation session font.

This works Terminal:

  print '\ 033 [1; 30m '+ sentence 2 [i] +' \ 033 [1; M ' 

This is when I try to write in a file:

  f.write (' \ 033 [1; 30m '+ sentence 2] [I] + '\ 033 [1; m]]  

Output:

When you are working with pixels, sometimes it's for you Working pixels are useful for obtaining X- and / or Y-value. # [1; 30 meters when you are working with pixels, sometimes it's working for you, pixels of X- and Useful for / or receiving Y-Value. # [1; m

In addition, how do I make it a definite font?

To add to my comment: If you want to create an HTML file (where you can apply formatting), try this: File index.html (or .html ), and write it: f.write ("" "& lt; p style =" color: red; font-family: 'Liberation sessions ', Without-serif' & gt; {} & lt; / p & gt; "" ".format (sentence 2 [i]))


No comments:

Post a Comment